Advertisement
PROFESSOR_AIH

Above the Secundary Diagonal

Apr 20th, 2022
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.50 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     int i,j,n=11;
  5.     double M[12][12],sum=0.0;
  6.     char ch;
  7.     scanf("%c",&ch);
  8.  
  9.     for(i=0; i<12; i++)
  10.     {
  11.         for(j=0; j<12; j++)
  12.         {
  13.             scanf("%lf",&M[i][j]);
  14.         }
  15.     }
  16.     for(i=0; i<12; i++)
  17.     {
  18.         for(j=0; j<n; j++)
  19.         {
  20.            sum=sum+M[i][j];
  21.         }
  22.         n--;
  23.     }
  24.     if(ch=='S')
  25.         printf("%.1lf\n",sum);
  26.     else if(ch=='M')
  27.         printf("%.1lf\n",(sum/66.0));
  28.     return 0;
  29. }
  30.  
  31.  
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement