fork download
  1. #include <stdio.h>
  2. #define N 10
  3. int main(void) {
  4. // your code goes here
  5. int a[10], i,j,t;
  6. printf("input 10 numbers :\n");
  7. for (i=0;i<N;i++) scanf("%d",&a [i]);
  8. printf("\n");
  9. for(i=0;i<N-1;i++)
  10. for(j=0;j<N-1-i;j++)
  11. if (a[j]<a[j+1])
  12. {t=a[j];a[j]=a[j+1];a[j+1]=t;}
  13. printf("the sorted numbers: \n");
  14. for(i=0;i<N;i++) printf("%d ",a[i]);
  15. printf("\n");
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0s 5308KB
stdin
8 5 34 23 11 9 7 6 4 3
stdout
input 10 numbers :

the sorted numbers: 
34 23 11 9 8 7 6 5 4 3