Advertisement
Schknheit

matriz 3x3 e quantidade de pares

May 15th, 2015
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.38 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.             if(mat[i][j]%2==0){
  19.                 soma = soma + mat[i][j];   
  20.             }
  21.         }
  22.     }
  23.    
  24.     printf("A soma: %d", soma);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement