arrange numbrs in ascending order in c
#include <stdio.h> #include <conio.h> void main () { int a[100]; int temp,n,i,j; printf("How many numbers do you want to enter? : "); scanf("%d",&n); for (i=0;i<n;i++) { printf("Enter %d number: ",i+1); scanf("%d",&a[i]); } printf("\n\n.....arranging in ascending order.....\n\n"); for (i = 0; i < n; ++i) { for (j = i + 1; j < n; ++j) { if (a[i] > a[j]) { temp = a[i]; a[i] = a[j]; a[j] = temp; } } } for (i=0;i<n;i++) { printf("%d ",a[i]); } }