fork download
  1. #include <stdio.h>
  2. #define _CRT_SECURE_NO_WARNINGS
  3.  
  4. #define NUMBER 3 // the number of students
  5.  
  6. int main(void){
  7. int i;
  8. int tensu[NUMBER];
  9.  
  10. for(i=0;i<NUMBER;i++){
  11. scanf("%d",&tensu[i]);
  12. }
  13.  
  14. if(NUMBER%2==0){ //NUMBER is not odd
  15.  
  16. for(i=0;i<NUMBER/2;i++){
  17. int temp[NUMBER];
  18. temp[i] = tensu[i];
  19. tensu[i] = tensu[NUMBER-i-1];
  20. tensu[NUMBER-i-1] = temp[i];
  21. }
  22. }else{
  23. for(i=0;i<(NUMBER-1)/2;i++){
  24. int temp[NUMBER];
  25. temp[i] = tensu[i];
  26. tensu[i] = tensu[NUMBER-i-1];
  27. tensu[NUMBER-i-1] = temp[i];
  28. }
  29. }
  30.  
  31. for(i=0;i<NUMBER;i++){
  32. printf("%d\n",tensu[i]);
  33. }
  34.  
  35. return 0;
  36. }
  37.  
Success #stdin #stdout 0s 2056KB
stdin
2
3
9
stdout
9
3
2