diogoAlves

IFF/Introdução à Programação/Slide/Pag 48/Ex 4

Mar 6th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.46 KB | None | 0 0
  1. //IFF - Introdução à Programação
  2. //Slide - Página 48 - Exercício 4
  3. #include<stdio.h>
  4. #include<locale.h>
  5.  
  6. int main(){
  7.     setlocale(LC_ALL,"Portuguese");
  8.     int matriz[3][3], soma[3]={0,0,0};
  9.     for (int c=0;c<3;c++){
  10.         for(int l=0;l<3;l++){
  11.             printf("Entre com o valor da posição (%d,%d): ",l+1,c+1);
  12.             scanf("%d",&matriz[l][c]);
  13.             soma[c]+=matriz[l][c];
  14.         }
  15.     }
  16.     for(int i=0;i<3;i++) printf("\nA soma da %dª coluna: %d",i+1,soma[i]);
  17.     return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment