write a program to add the diagonal elements of a double dimensional array using c-language (in coding form)
Write a program to add the diagonals of a double dimensional array using c-language?
for (i=0;i%26lt;size,i++)
{
for(j=0;j%26lt;size;j++)
{
if(i==j)
sum1+=x[i][j];
if(i+j==size-1)
sum1+=x[i][j];
}
}
the program will sum up both diagonals sepatately
but you need to properly develop code from the logical help i have provided
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment