X
ONLINE BOOKING
BOOK NOW
OFFLINE BOOKING
Call or WhatsApp 7993732682 (WhatsApp Now), 9177341827 (WhatsApp Now)
X
• Home
• Legal Disclaimer
• Terms & Conditions
• Return Policy
• Need any help?? write to us at

support@engineershub.co

X
Go Back
Go Back
Go Back
OR
Fill Up a Simple Form
Fill all the below details correctly and click on Next
Go Back
Write a program to perform matrix addition? - EngineersHub
Go Back
Question
Anandam Lokesh
3 years ago
Answer posted by Venu Gopal reddy Seelam
3 years ago

#include<stdio.h>

#include<conio.h>

#include<process.h>

void main( )

{

int a[10][10],b[10][10],c[10][10];

int i,j,m,n,p,q;

printf("\n Enter the size of matrix A:");

scanf("%d%d",&m,&n);

printf("\n Enter the size of Matrix B:");

scanf("%d%d",&p,&q);

if(m!=p||n!=q)

{

exit(0);

}

printf(" Enter the matrix B values:\n");

for(i=0;i<m;i )

for(j=0;j<n;j )

scanf("%d",&a[i][j]);

print("Enter the Matrix B values:\n");

for(i=0;i<p;i )

for(j=0;j<n;j )

c[i][j]=a[i][j] b[i][j];

printf("\n The Matrix A is \n");

for(i=0;i<m;i )

{

for(j=0;j<n;j )

printf('%d",a[i][j]);

print("\n");

}

printf("\n The Martix B is\n");

for(i=0;i<p;i )

{

for(j=0;j<q;b[i][j]);

printf("%d",b[i][j]);

printf("\n");

}

printf("\n The  Output Matrix C is\n");

for(i=0;i<m;i )

{

for(j=0;j<n;j )

printf("%d",c[i][j]);

printf("\n");

}

}

OUTPUT :

Enter the size of Matrix A:2

3

Enter the size of Matrix B:2

3

Enter the matrix A values:

1

2

3

4

5

6

Enter the Matrix B values:

6

5

4

3

2

1

The Matrix A is

1 2 3

4 5 6

The matrix B is

6 5 4

3 2 1

The Output Matrix C is

7 7 7

7 7 7

### Users Joined

mahek thakur
11 months ago
sowmya
11 months ago
biraja
11 months ago
Diana R
1 year ago
P Annapoorani
1 year ago
X
Write a program to perform matrix addition?
X
Write a program to perform matrix addition?

#include<stdio.h>

#include<conio.h>

#include<process.h>

void main( )

{

int a[10][10],b[10][10],c[10][10];

int i,j,m,n,p,q;

printf("\n Enter the size of matrix A:");

scanf("%d%d",&m,&n);

printf("\n Enter the size of Matrix B:");

scanf("%d%d",&p,&q);

if(m!=p||n!=q)

{

exit(0);

}

printf(" Enter the matrix B values:\n");

for(i=0;i<m;i )

for(j=0;j<n;j )

scanf("%d",&a[i][j]);

print("Enter the Matrix B values:\n");

for(i=0;i<p;i )

for(j=0;j<n;j )

c[i][j]=a[i][j] b[i][j];

printf("\n The Matrix A is \n");

for(i=0;i<m;i )

{

for(j=0;j<n;j )

printf('%d",a[i][j]);

print("\n");

}

printf("\n The Martix B is\n");

for(i=0;i<p;i )

{

for(j=0;j<q;b[i][j]);

printf("%d",b[i][j]);

printf("\n");

}

printf("\n The  Output Matrix C is\n");

for(i=0;i<m;i )

{

for(j=0;j<n;j )

printf("%d",c[i][j]);

printf("\n");

}

}

OUTPUT :

Enter the size of Matrix A:2

3

Enter the size of Matrix B:2

3

Enter the matrix A values:

1

2

3

4

5

6

Enter the Matrix B values:

6

5

4

3

2

1

The Matrix A is

1 2 3

4 5 6

The matrix B is

6 5 4

3 2 1

The Output Matrix C is

7 7 7

7 7 7

x