Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I changed the sorting method used #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions Array/2L2S.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,14 @@ void main ()
printf ("Enter the numbers \n");
for (i=0; i<n; ++i)
scanf ("%d",&number[i]);

for (i=0; i<n; ++i)
{
for (j=i+1; j<n; ++j)
{
if (number[i] < number[j])
{
a = number[i];
number[i] = number[j];
number[j] = a;
}


for (i = 0; i < n; i++){
a = number[i];
for (j = i-1; j>=0 && a<number[j] ; j--){
number[j+1]=number[j];
}
number[j+1]=a;
}

printf ("The numbers arranged in descending order are given below\n");
Expand Down Expand Up @@ -88,4 +84,4 @@ void main ()
The average of 80 and 30 is = 55 is not in the array


-------------------------------------------------------*/
-------------------------------------------------------*/