fork download
  1. /*array07.c*/
  2. #define NO 3
  3. #include <stdio.h>
  4.  
  5. int main(void)
  6. {
  7. // your code goes here
  8. int point[3][2]={{80,80},{100,98},{60,80}};
  9. int i,j,sum=0,p_sum[NO];
  10. double ave;
  11.  
  12. for(i=0;i<NO;i++)
  13. sum += point[i][0];
  14. ave = (double)sum/NO;
  15. printf("A score of English test is %5.1f\n",ave);
  16.  
  17. sum=0;
  18. for(i=0;i<3;i++)
  19. sum+=point[i][1];
  20. ave=(double)sum/NO;
  21. printf("A score of Mathmatics test is %5.1f\n\n",ave);
  22.  
  23. for(i=0;i<NO;i++)
  24. p_sum[i]=0;
  25.  
  26. for(i=0;i<NO;i++)
  27. {
  28. for(j=0;j<2;j++)
  29. {
  30. p_sum[i]+=point[i][j];
  31. }
  32. printf("The totalscore of number%d is %d\n",i+1,p_sum[i]);
  33. }
  34.  
  35. return 0;
  36. }
  37.  
Success #stdin #stdout 0s 5264KB
stdin
Standard input is empty
stdout
A score of English test is  80.0
A score of Mathmatics test is  86.0

The totalscore of number1 is 160
The totalscore of number2 is 198
The totalscore of number3 is 140