answersLogoWhite

0


Best Answer

#include<iostream.h>

#include<conio.h>

void main()

{

clrscr();

int a[10][10],b[10][10],c[10][10],m,n,i,j;

cout<<"Enter number of rows: ";

cin>>m;

cout<<"Enter number of coloumns: ";

cin>>n;

cout<<endl<<"Enter elements of matrix A: "<<endl;

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

{

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

{

cout<<"Enter element a"<<i+1<<j+1<<": ";

cin>>a[i][j];

}

}

cout<<endl<<"Enter elements of matrix B: "<<endl;

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

{

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

{

cout<<"Enter element b"<<i+1<<j+1<<": ";

cin>>b[i][j];

}

}

cout<<endl<<"Displaying Matrix A: "<<endl<<endl;

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

{

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

{

cout<<a[i][j]<<" ";

}

cout<<endl<<endl;

}

cout<<endl<<"Displaying Matrix B: "<<endl<<endl;

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

{

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

{

cout<<b[i][j]<<" ";

}

cout<<endl<<endl;

}

cout<<endl<<"Matrix A + Matrix B = Matrix C: "<<endl<<endl;

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

{

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

{

cout<<a[i][j]+b[i][j]<<" ";

}

cout<<endl<<endl;

}

getch();

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

iggkb

fgihbn

nfgn

fgn

fgn

fgn

ata to tere se puchhta kya be pagle

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Program to find the sum and difference of two matrices?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is matrix programming in C programming?

C Examples on Matrix OperationsA matrix is a rectangular array of numbers or symbols arranged in rows and columns. The following section contains a list of C programs which perform the operations of Addition, Subtraction and Multiplication on the 2 matrices. The section also deals with evaluating the transpose of a given matrix. The transpose of a matrix is the interchange of rows and columns.The section also has programs on finding the trace of 2 matrices, calculating the sum and difference of two matrices. It also has a C program which is used to perform multiplication of a matrix using recursion.C Program to Calculate the Addition or Subtraction & Trace of 2 MatricesC Program to Find the Transpose of a given MatrixC Program to Compute the Product of Two MatricesC Program to Calculate the Sum & Difference of the MatricesC Program to Perform Matrix Multiplication using Recursion


Writes a c program to find the sum of all integers between 1 and n?

Write a program to find the number and sum of all integers from 100 to 300 that are divisible by 11


Java program to find sum on even numbers from 12-45?

sum = 0; for (int i = 12; i


What is the first line of every FORTRAN program and what does it tell the compiler?

The name of the program. For example: program sum ! This is a comment. Your program's code goes here... end program sum


Write a c program to find the sum of numbers between given limits?

int sum (int min, int max) {return (max-min+1)*(max+min)/2;}

Related questions

Write a C program to find sum of 3 matrices?

matrix


What is matrix programming in C programming?

C Examples on Matrix OperationsA matrix is a rectangular array of numbers or symbols arranged in rows and columns. The following section contains a list of C programs which perform the operations of Addition, Subtraction and Multiplication on the 2 matrices. The section also deals with evaluating the transpose of a given matrix. The transpose of a matrix is the interchange of rows and columns.The section also has programs on finding the trace of 2 matrices, calculating the sum and difference of two matrices. It also has a C program which is used to perform multiplication of a matrix using recursion.C Program to Calculate the Addition or Subtraction & Trace of 2 MatricesC Program to Find the Transpose of a given MatrixC Program to Compute the Product of Two MatricesC Program to Calculate the Sum & Difference of the MatricesC Program to Perform Matrix Multiplication using Recursion


Write a program that will accept two numbers and find their sum anddifferences. If the sum is more than the difference, display the sum otherwisedisplay the difference. Pascal programming?

program SumAndDifference; var num1, num2, sum, difference: integer; begin write('Enter first number: '); read(num1); write('Enter second number: '); read(num2); sum := num1 + num2; difference := num1 - num2; if sum &gt; difference then written('The sum is greater: ', sum) else written('The difference is greater: ', difference); end. This program will prompt the user to enter two numbers, calculate their sum and difference, and then compare the two values. If the sum is greater than the difference, it will display the sum; otherwise, it will display the difference.


Write a c program using dynamic memory allocation function calloc to find sum of two matrices and also print the resultant matrix?

printf("%s",per&gt;50?:"pass",per&lt;50?:"fail");


What do it mean do find a sum or difference in fraction?

The sum is the answer for adding and the difference is the answer for subtracting...


How do you write an assembly language program to find the sum of n numbers using array?

write an assembly language program to find sum of N numbers


What methods can you use to solve for the sum or difference of integers?

To find the sum of integers, you use addition.To find the difference, you use subtraction.


Write a program to find the sum of all positive number and terminate the program when sum exceed 999?

int sum = 0; int n = 0; while( sum &lt;= 999 ) { sum += (++n); }


When adding or subtracting matrices do the dimensions of the sum or differences always match the original matrices?

Yes, because otherwise addition and subtraction are not defined.


How do you find the sum or difference of a fraction?

The sum of a fraction? Well, to find the sum of the fraction all you do is divide both top and bottom numbers.


Writes a c program to find the sum of all integers between 1 and n?

Write a program to find the number and sum of all integers from 100 to 300 that are divisible by 11


Java program to find sum on even numbers from 12-45?

sum = 0; for (int i = 12; i