Skip to content

Instantly share code, notes, and snippets.

@baghaleech
Created January 4, 2022 05:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baghaleech/03088106421d66a6b7534e8183fc7400 to your computer and use it in GitHub Desktop.
Save baghaleech/03088106421d66a6b7534e8183fc7400 to your computer and use it in GitHub Desktop.
#include<stdio.h>
#include<conio.h>
int main()
{
int mat[3][3], i, j, sum;
sum = 0;
printf("Enter all 9 elements of 3*3 Matrix:-\n");
for(i=0; i<3; i++)
{
for(j=0; j<3; j++)
{
scanf("%d", &mat[i][j]);
}
}
for(i=0; i<3; i++)
{
for(j=0; j<3; j++)
{
sum = sum + mat[i][j];
}
}
printf("\nSum of all elements = %d", sum);
getch();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment