Computer Science, asked by peehurani4334, 1 year ago

Write a program in c which accepts 10 integers in an array and then arrange them in asceding order

Answers

Answered by Anonymous
0
/*C Program to arrange 10 numbers in ascending order*/ #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\nThe 10 numbers sorted in ascending order are: \n”); for(i=0;i<10;i++) printf(“%d\t”,a[i]); getch(); }
Similar questions