Perform addition of 3x3 matrix.
This post content:-
Algorithm
Flowchart
C code
Output
Pdf notes
Step 1:- start.
Step 2 :- declare variables int a[10]10],b[10][10],c[10][10],i,j;
Step 3:- take input for two matrices.
printf(“enter all elements of first matrix : \n”);
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
scanf(“%d”,&a[i][j]);
}
}
printf(“enter all elements of second matrix : \n”);
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
scanf(“%d”,&b[i][j]);
}
}
Step 4:- add the both matrix.
printf(“sum of matrices are: \n”);
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
c[[i][j]=a[i][j]+b[i][j];
printf(“%d \t ”,c[i][j]);
}
printf(“\n”);
}
Step 5:- END.
Flowchart:-
C code:-
Output:-
Try it yourself:-
Comments
Post a Comment