In this section, you will learn how to determine the sum of both the diagonal of 3X3 matrix. For this, we have declared an array of integers and using the for loops, we have determined the sum of both the diagonals.
Here is the code:
|
#include <stdio.h> void main() { |
Output:
| 1 2 6 3 8 5 5 6 7 Sum of First diagonal=16 Sum of Second diagonal=19 |
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.