fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. // your code goes here
  5. int n,m;
  6. int score[5]={0,};
  7. int arr[4][12]={0,}; // korea eng math science, korea
  8. // 0,4,8 1,5,9 2,6,10 3,7,11
  9. int studyroom[5]={0,};
  10.  
  11. float avg;
  12. while(1) {
  13. scanf("%d",&n);
  14. if(n<=3) break;
  15. }
  16.  
  17. for(int i=1;i<=n;i++) {
  18. for(int j=0;j<12;j++) {
  19. scanf("%d",&arr[i][j]);
  20. score[j%4]+=arr[i][j];
  21. studyroom[i]+=arr[i][j];
  22. printf("%d ",arr[i][j]);
  23. }
  24. printf("\n");
  25. }
  26. for(int i=1;i<=n;i++) {
  27. printf("%d\n",studyroom[i]);
  28. // printf("%d",score[i]);
  29. }
  30. printf("\n");
  31. for(int i=0;i<4;i++) {
  32. printf("%d\n",score[i]);
  33. }
  34.  
  35. }
  36.  
Success #stdin #stdout 0s 5452KB
stdin
1
3 3 4 
3 3 3 
3 3 3 
3 3 3
stdout
3 3 4 3 3 3 3 3 3 3 3 3 
37

9
9
10
9