write a program to input and store integer elements in a double dimensional array of size 3*3and find the sum of the elements in the left diagonal.example:-1 3 5 down 4 6 8 down 9 2 4.output:- sum of the left diagonal elements in the left diagonal elements=(1+6+4)=11
Answers
Answered by
0
Explanation:
in c programming
#include<stdio.h>
int main()
{
int i,j,r,c,a[10][10],sum=0;
scanf("%d %d",&i,&j);
for(r=0;r<i;r++)
{
for(c=0;c<j;c++)
{
scanf("%d",&a[r][c]);
}
}
for(r=0;r<i;r++)
{
sum=sum+a[r][r];
}
printf("sum of digonal elements is %d",sum);
}
Attachments:
Similar questions