Answer :
#include<stdio.h>
int main ()
{
int a,b,sum=0,r,c;
int x[100][100];
printf("Enter the number of row of the matrix : ");
scanf("%d",&a);
printf("Enter the number of the column : ");
scanf("%d",&b);
for (r=1;r<=a;r++)
{
for (c=1;c<=b;c++)
{
printf("Enter the elements of the Matrix %d%d : ",r,c);
scanf("%d",&x[r][c]);
}
}
printf("The Enter matrix is \n");
for (r=1;r<=a;r++)
{
for (c=1;c<=b;c++)
{
printf("%d ",x[r][c]);
}
printf("\n");
}
printf ("The sum of the element of matrix is : ");
for (r=1;r<=a;r++)
{
for (c=1;c<=b;c++)
{
sum=sum+x[r][c];
}
}
printf("%d",sum);
}
Output :
0 Comments