Sum of diagonal elements

Question:

Write a program to find the sum of diagonal elements

 

Program:

Explanation:

Diagonal elements are those where i=j, as in a[0][0], a[1][1] etc.the for loop cheks every instant if i is equal to j, if true value of a[i][j] is incremented to sum.

Output:

 

Leave a Reply

bodrum escort - eskişehir esc - mersin escort - mersin escort bayan - mersin esc