Advertisement
Avdluna

yyyyyyy

Aug 17th, 2015
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.49 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3.  
  4. int main(){
  5.     int f,k,i,j,y,soma = 0,x[12][12];
  6.     char o;
  7.        
  8.         scanf("%d", &y);
  9.         scanf("%s", &o);
  10.  
  11.         for(i=0;i<12;i++){
  12.             for(j=0;j<12;j++){
  13.                 scanf("%d", &x[i][j]);
  14.             }
  15.         }
  16.        
  17.         if(strcmp(o,"S") == 0){
  18.             for(k=0 ; k<12 ; k++){
  19.                 soma += x[y][k];
  20.             }
  21.            
  22.             printf("%d\n", soma);
  23.         }
  24.        
  25.         if(strcmp(o,"M") == 0){
  26.             for(f=0 ;f<12 ; f++){
  27.                 soma += x[y][i];
  28.             }
  29.            
  30.             printf("%d\n", soma/12);
  31.         }
  32.  
  33.              return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement