Advertisement
Schknheit

matriz 3x3 e soma elemento

May 15th, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(){
  4.  
  5. int i, j, soma = 0, mat[3][3];
  6.  
  7. printf("Entre com quatro elementos: \n");
  8.  
  9. for(i = 0; i < 3; i++){
  10. for(j = 0; j < 3; j++){
  11. scanf("%d",&mat[i][j]);
  12. }
  13. }
  14.  
  15. for(i = 0; i < 3; i++){
  16. printf("\n");
  17. for(j = 0; j < 3; j++){
  18. soma = soma + mat[i][j];
  19. }
  20. }
  21.  
  22. printf("A soma: %d", soma);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement