write a c program to sort in ascending order of n


Write a C program to sort in ascending order of n numbers.

# include

# include

void main()

{

int a[25],no,i,j,m,t;

clrscr();

printf("\nEnter Total number of inputs : ");

scanf("%d",&no);

printf("\nEnter %d number : ",no);

no--;

for(i=0;i<=no;i++)

scanf("%d",&a[i]); /* Enter array elements */

for(i=0;i<=no;i++) /* Number of Passes */

{

for(j=0;j

/*Compare an element with the next element one by one*/

{

if(a[j]

{

t=a[j]; /* Interchange the two if first is smaller */

a[j]=a[j+1];

a[j+1]=t;

}

}

}

printf("\n Sorted numbers are :\n");

for(i=0;i<=no;i++)

printf("%d",a[i]);

getch();

}

 

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: write a c program to sort in ascending order of n
Reference No:- TGS0305515

Expected delivery within 24 Hours