Untitled
unknown
plain_text
7 months ago
855 B
0
Indexable
Never
#include<stdio.h> void main(){ system("color f0"); int m1[10][10],m2[10][10],m3[10][10],r1,c1,r2,c2,i,j; printf("Enter the rows and colums for 1st matrix:\n"); scanf("%d%d",&r1,&c1); printf("Enter the rows and colums for 2nd matrix:\n"); scanf("%d%d",&r2,&c2); if(r1==r2&&c1==c2){ printf("Enter the elements 1st matrix:\n"); for(i=0;i<r1;i++){ for(j=0;j<c1;j++){ scanf("%d",&m1[i][j]); } } printf("Enter the elements 2nd matrix:\n"); for(i=0;i<r2;i++){ for(j=0;j<c2;j++){ scanf("%d",&m2[i][j]);} } printf("the sum of two matrix is\n"); for(i=0;i<r1;i++){ for(j=0;j<c1;j++){ m3[i][j]=m1[i][j]+m2[i][j]; printf("%d\t",m3[i][j]); } printf("\n"); }
Leave a Comment