CODING:
#include<conio.h>
#include<stdio.h>
void main()
{
int a[10][10],i,j,m,n,sum=0;
clrscr();
printf("Enter order of matrix: ");
scanf("%d%d",&m,&n);
printf("\n\n");
for(i=1;i<=m;i++)
for(j=1;j<=n;j++)
{
printf("Enter value of a[%d][%d]: ",i,j);
scanf("%d",&a[i][j]);
sum+=a[i][j];
}
printf("\n\nSum of elements of matrix is %d",sum);
getch();
}
#include<conio.h>
#include<stdio.h>
void main()
{
int a[10][10],i,j,m,n,sum=0;
clrscr();
printf("Enter order of matrix: ");
scanf("%d%d",&m,&n);
printf("\n\n");
for(i=1;i<=m;i++)
for(j=1;j<=n;j++)
{
printf("Enter value of a[%d][%d]: ",i,j);
scanf("%d",&a[i][j]);
sum+=a[i][j];
}
printf("\n\nSum of elements of matrix is %d",sum);
getch();
}
CODING |
Click on images to view them correctly.
OUTPUT |
For any query or suggestion please comment below...
No comments:
Post a Comment