Write C program that to add following two matrixes and display output.
{5 7 8 109 3 0 68 1 9 24 7 2 1} + {2 2 1 3 8 1 3 11 2 2 43 1 1 2} = {7 9 9 1317 4 3 79 3 11 67 8 3 3}
#include<stdio.h>
int main()
{
int x, t, num, d, F[5][5], S[5][5], add[5][5];
printf("Input the number of rows and columns of matrix\n");
scanf("%d%d", & x, & t);
printf("Input the elements of first matrix\n");
for (num = 0; num < x; num++)
for (d = 0; d < t; d++) scanf("%d", & F[num][d]);
printf("Input the elements of second matrix\n");
for (num = 0; num < x; num++)
for (d = 0; d < t; d++) scanf("%d", & S[num][d]);
printf("Sum of entered matrices:-\n");
for (num = 0; num < x; num++)
{
for (int numss = 0; numss < t; numss++)
{
add[num][numss] = F[num][numss] + S[num][numss];
printf("%d\t", add[num][numss]);
}
printf("\n");
}
return 0; }
Comments
Leave a comment