Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.78 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main() {
  5.    
  6.    
  7. int m[7][7];
  8. int x = 0;
  9. int y = 0;
  10. int somaL = 0;
  11.  
  12. printf("Digite um numero inteiro para cada linha:\n");
  13.     for(x=0;x<7;x++)
  14.     {
  15.         for(y=0;y<7;y++)
  16.         {
  17.             printf("\nlinha %d, coluna %d da matriz: ",x,y);
  18.             scanf("%d",&m[x][y]);          
  19.         }  
  20.     }
  21.     printf("Linha 7:");
  22.     for(y=0;y<7;y++)
  23.         {
  24.             x = 7;
  25.             printf("%d ",m[7][y]);
  26.             somaL += m[7][y];      
  27.         }
  28.     printf("Linha 6:");
  29.     for(y=1;y<6;y++)
  30.         {
  31.             x = 6;
  32.             printf("%d ",m[6][y]);
  33.             somaL += m[6][y];          
  34.         }
  35.     printf("Linha 5:");
  36.     for(y=2;y<5;y++)
  37.         {
  38.             x = 5;
  39.             printf("%d ",m[5][y]);
  40.             somaL += m[5][y];          
  41.         }
  42.     printf("Linha 4:");
  43.     x = 4;
  44.     printf("%d ",m[4][y]);
  45.     somaL += m[4][y];
  46.     printf("Somatório das linhas demarcadas: %i",somaL);
  47.        
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement