Advertisement
mdnurnobihosen

URI Basic 1185

Apr 3rd, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.55 KB | None | 0 0
  1. //Problem URI 1185
  2. //https://www.urionlinejudge.com.br/judge/en/problems/view/1185
  3.  
  4. #include<stdio.h>
  5. int main()
  6. {
  7.     char S;
  8.     double M[12][12],sum=0,avg=0;
  9.     int i,j,n=11;
  10.     scanf("%c",&S);
  11.     for(i=0;i<12;i++)
  12.     {
  13.         for(j=0;j<12;j++)
  14.         {
  15.             scanf("%lf",&M[i][j]);
  16.         }
  17.     }
  18.     for(i=0;i<12;i++)
  19.     {
  20.         for(j=0;j<n;j++,n--)
  21.            sum+=M[i][j] ;
  22.     }
  23.     if(S=='S'){printf("%.1lf\n",sum);}
  24.     else if(S=='M'){
  25.         avg=sum/66.0;
  26.             printf("%.1lf\n",avg);}
  27.  
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement