Answer to Question #255950 in C for Sandun

Question #255950

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}


1
Expert's answer
2021-10-24T18:49:58-0400
#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;  }

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS