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 print diagonal elements of matrix
C program to print diagonal elements of matrix
Output:
Enter the elements of matrix:
1 2 3
4 5 6
7 8 9
The diagonal elements of the matrix are:
1 5 9
Implementation:
#include
#define r 3 // set the row size here #define c 3 // set the column size here int main(void) { int a[r][c]; int i,j; printf("Enter the elements of matrix:\n"); for(i=0;i
PREVIOUS
NEXT
HOME