Untitled

 avatar
unknown
plain_text
3 years ago
888 B
3
Indexable
#include<stdio.h>
int main(){
int mat[100][100],n,m,sum_odd=0,sum_even=0,sum_all=0,mod_result,id;
printf("Enter the value of the row and column: \n");
scanf("%d %d",&n,&m);
printf("\nEnter the values in the matrix: \n");
for(int i=0;i<n;i++)
{
    for(int j=0;j<m;j++)
    {
        scanf("%d",&mat[i][j]);
    }
}

for(int i=0;i<n;i++)
{
    for(int j=0;j<m;j++)
    {
      sum_all+=mat[i][j];
      if(mat[i][j]%2==0)
      {
          sum_even+=mat[i][j];
      }
      if(mat[i][j]%2==1)
      {
          sum_odd+=mat[i][j];
      }
    }
}

printf("\nEnter a Two digit Id: \n");
scanf("%d",&id);
mod_result=id%10;


printf("Sum of all elements: %d\nSum of Even Numbers: %d\nSum of odd numbers: %d\nThe modulous of the ID (%d) is: %d\nSum of everything is: %d",sum_all,sum_even,sum_odd,id,mod_result,sum_all+sum_even+sum_odd+id+mod_result);


}