First time here? Checkout the FAQ!
x
menu search
brightness_auto
more_vert
Write a C program to accept 10 integers from the user and arrange them in ascending order and display them.
thumb_up_off_alt 1 like thumb_down_off_alt 0 dislike

1 Answer

more_vert
 
verified
Best answer
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,temp,a[10];
//clrscr();
printf("Enter 10 integer numbers: \n");
for(i=0;i<10;i++)
scanf("%d",&a[i]);
for (i=0;i<10;i++)
{
for(j=i+1;j<10;j++)
{
if(a[i]>a[j])
{
temp=a[j];
a[j]=a[i];
a[i]=temp;
}
}
}
printf("\n\n The 10 numbers sorted in ascending order are: \n");
for(i=0;i<10;i++)
printf("%d\t",a[i]);
getch();
}
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
more_vert
https://onlinegdb.com/Tfz4BBNGP
...