SCHOOL OF CODE BUILDERS
Learn To CODE. Become A DEVELOPER.
Pages
HOME
DATA STRUCTURES
STRINGS
ARRAYS
MATRIX
BINARY TREES
LINKED LIST
STACK
QUEUE
SORTING
SEARCHING
C
PYTHON
PSEUDOCODE
CONTEST PROBLEMS
ALGORITHMS
PATTERNS
PHP
C PUZZLES
C INTERVIEW QUESTIONS
JAVA
C++
HASHING
RECURSION
BASIC C PROGRAMS
TCS-CODEVITA
FACEBOOK
CONTACT US
C program to add the diagonal elements of a matrix
C program to add the diagonal elements of a matrix
Output:
Enter the elements of the 3x3 array:
1 2 3
4 5 6
7 8 9
The sum of the diagonal elements is 15
Implementation:
#include
#define r 3 #define c 3 int main(void) { int a[r][c],diagsum=0; int i,j; printf("Enter the elements of the 3x3 array:\n"); for(i=0;i
PREVIOUS
NEXT
HOME