asadlive84

Even/ODD With namta

Jan 22nd, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.82 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     int namta_10[10][10];
  6.     int row, col, res1, res2 = 0, even = 0, odd = 0;
  7.  
  8.     for(row = 1; row <= 10; row++)
  9.     {
  10.         res1 = 0;
  11.         for(col = 1; col <= 10; col++)
  12.         {
  13.             res1 = res1 + row;
  14.             namta_10[row - 1][col - 1] = res1;
  15.             printf("%d x %d = %d\n", row, col, namta_10[row - 1][col -1]);
  16.             res2 = res2 + namta_10[row - 1][col -1];
  17.             if(namta_10[row - 1][col -1] % 2 == 0)
  18.             {
  19.                 even++;
  20.             }
  21.             else
  22.             {
  23.                 odd++;
  24.             }
  25.         }
  26.         printf("\t");
  27.     }
  28.     printf("Total summation is= %d\n", res2);
  29.     printf("Total number even number is= %d\n", even);
  30.     printf("Total number of odd number is= %d\n", odd);
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment