Advertisement
lButcherl

Matriz 03

Nov 1st, 2013
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.71 KB | None | 0 0
  1. /*3. Crie um algoritmo que leia uma matriz de dimensão 3 x 3 e apresente na tela a quantidade de elementos
  2. pares desta matriz.*/
  3.  
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #define tam 3
  7.  
  8. main()
  9. {
  10.       int i,j,mata[tam][tam],par=0;
  11.       for (i = 0; i < tam; i++)
  12.       {
  13.           for (j = 0; j < tam; j++)
  14.           {
  15.               printf("Informe o numero: ");
  16.               scanf("%i", &mata[i][j]);
  17.               if (mata[i][j] % 2 == 0)
  18.               {
  19.                              par++;
  20.                              }
  21.                              }
  22.                              }
  23.                              printf("Numeros pares: %i\n",par);
  24.                system("pause");
  25.               }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement