Addition and Subtraction of two matrix - C Programming Language | Chetan TM

# Question: Addition and Subtraction of Two Matrix

/* Addition and Subtraction of two matrix */
/* Program Coded By Chetan Thapa Magar */

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int m, n, i, j, a[10][10], b[10][10], add[10][10], sub[10][10];
printf("Enter the numbers for rows:\t");
scanf("%d", &m);
printf("\nEnter the number of columns:\t");
scanf("%d", &n);
printf("\nEnter the element of matrix A:\n");
for(i=0; i<m; i++)
for(j=0; j<n; j++)
scanf("%d", &a[i][j]);
printf("\nEnter the elements of matrix B:\n");
for(i=0; i<m; i++)
for(j=0; j<n; j++)
scanf("%d", &b[i][j]);
printf("\nThe Addition of Two Matrix is:\n");
for(i=0; i<m; i++)
{
for(j=0; j<n; j++)
{
}
printf("\n");
}
printf("\nThe Subtraction of Two Matrix is:\n");
for(i=0; i<m; i++)
{
for(j=0; j<n; j++)
{
sub[i][j]=a[i][j]-b[i][j];
printf("%d\t", sub[i][j]);
}
printf("\n");
}
getch();
}
Output / Execution:
Enter the number of rows: 3
Enter the number of columns: 3
Enter the elements of matrix A:
1

Enter the elements of matrix B:
9

The Addition of Two Matrix is:
10 10 10
10 10 10
10 10 10

The Subtraction of Two Matrix is:
-8 -6 -4
-2  0  2
4  6  8

# C Programming:

Name

ltr
item
Chetan TM: Addition and Subtraction of two matrix - C Programming Language
Addition and Subtraction of two matrix - C Programming Language
Tutor Chetan C Programming Language Question: Addition and Subtraction of Two Matrix
https://1.bp.blogspot.com/-RGmEMG-49eA/XtCQx7D6wJI/AAAAAAAABOU/6CDCGlQx6zc-9F6FLCshm76vStbNq6pmACLcBGAsYHQ/s16000/Part%2B1.jpg
https://1.bp.blogspot.com/-RGmEMG-49eA/XtCQx7D6wJI/AAAAAAAABOU/6CDCGlQx6zc-9F6FLCshm76vStbNq6pmACLcBGAsYHQ/s72-c/Part%2B1.jpg
Chetan TM
http://www.chetantm.com.np/
http://www.chetantm.com.np/