To find the sum of the diagonal elements
Answers
Answered by
0
void main()
{
int a[30][30],r,c;
cin>>r,c;
if(r==c)
{
sum=0;
for(int i=0;i<r;i++)
sum=sum+a[i][i];
cout<<"sum<<sum;
}
else
cout<<"invalid";
getch();
}
please rate to 5
{
int a[30][30],r,c;
cin>>r,c;
if(r==c)
{
sum=0;
for(int i=0;i<r;i++)
sum=sum+a[i][i];
cout<<"sum<<sum;
}
else
cout<<"invalid";
getch();
}
please rate to 5
Similar questions