Skip to content

SuvamRoutray/Insert-a-3x3-matrix-and-find-sum-of-its-diagonal-element

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

#include<stdio.h> #include<conio.h> void main() { int i,j,r,c,sum=0,a[3][3]; printf("Enter the elements of the array\n"); for(r=0;r<3;r++) { for(c=0;c<3;c++) { scanf("%d",&a[r][c]); } } printf("The entered array is \n"); for(r=0;r<3;r++) { for(c=0;c<3;c++) { printf("%d\t",a[r][c]); if(r==c) { sum=sum+a[r][c]; } } printf("\n"); } printf("The sum of all the diagonal elements of the matrix is:- %d",sum); getch(); }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published