#include <stdio.h> #include <stdlib.h> #include <math.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main() { int i,j,a[10],temp; 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[i]; a[i]=a[j]; a[j]=temp; } } } for(i=0;i<10;i++){ printf("%d\n",a[i]); } } |
Double click to view unformatted code.