1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
snow_lady [41]
4 years ago
12

6. Write a program to compute the sum and difference of two matrices which have the same order. Have the user enter the order of

the matrices and then have the user enter the elements in the two matrices, and then perform addition and subtraction of respective elements. You may have to use for loops to obtain the entries of the two matrices and also may have to use for loops to add/subtract the entries.
Computers and Technology
1 answer:
Nadya [2.5K]4 years ago
6 0

Answer:

see explaination

Explanation:

#include<iostream>

using namespace std;

main()

{

int rows,columns,first[10][10], second[10][10], sum[10][10],difference[10][10],i,j;

cout << "Enter number of rows:";

cin >> rows;

cout << "Enter number of columns:";

cin>> columns;

cout << "Enter the elements of first matrix\n";

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

{

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

cin >> first[i][j];

}

cout << "Enter the elements of second matrix\n";

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

{

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

cin >> second[i][j];

}

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

{

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

sum[i][j] = first[i][j] + second[i][j];

}

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

{

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

sum[i][j] = first[i][j] + second[i][j];

}

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

{

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

difference[i][j] = first[i][j] - second[i][j];

}

cout << "Sum of entered matrices:-\n";

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

{

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

cout << sum[i][j] << "\t";

cout << endl;

}

cout << "Difference of entered matrices:-\n";

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

{

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

cout << difference[i][j] << "\t";

cout << endl;

}

return 0;

}

see attachment for output

You might be interested in
Spoken word and written word are different because what
OLEGan [10]
Written word is expressed in writing while spoken word is expressed orally. 
6 0
3 years ago
In the terms of OOP, in the microwave system, current time is a BLANK and change heat is a BLANK
otez555 [7]

Answer:

1. Data and 2. procedures or functions

Explanation:

The object in an object oriented programming comprises of data and the procedures, The data describes the object, and the procedures explains what that particular object can do. And that is a function and nothing else. We declare a data, and procedure or function. We then initialize the data through constructor. And finally we does the operation like here its change heat by defining a function for it. A function is first declared, then defined and finally called for getting the desired output.

4 0
3 years ago
Clara works behind a computer all day. She gets a lot of headaches, and her eyes have been hurting her lately. Her doctor diagno
Vinil7 [7]

Answer:

Clara should use computer lenses and artifical tears.

The computer lenses help block blue light from entering your eyes which would help with the headaches and help you focus on something further away. The artificial tears help lubricate dry eyes which prevents or in Clara's case, reduces/relieves eye strain.

8 0
2 years ago
1 bulb controlled by 2-three way switches using 12 volts battery.<br><br> pahelp po
marta [7]

Answer:

Ok so what I can do for this question

5 0
3 years ago
If you receive an email message you suspect is spam, what should you do?
Alla [95]

Answer:

A.  delete the message without opening it.

Explanation:

Never open emails you don't know who sent it, it could be a hacker trying to get your personal/financial information.

6 0
4 years ago
Other questions:
  • By default, text is ______aligned and values are______________aligned
    6·1 answer
  • How does heat affect quantum computers ?
    10·1 answer
  • What is the purpose for adding images and graphics to a web page?
    5·1 answer
  • In a non-formatted/standard template, if the number 25 is converted to text format, the
    14·1 answer
  • Question 1
    10·1 answer
  • 01 Describe all the possible component of a chart​
    8·1 answer
  • What is a term commonly used to describe the Python dictionary feature in other programming languages
    9·1 answer
  • Write the text of the program in Python.
    12·1 answer
  • If you aren’t familiar with the idea of a leap year, read “Why Is There a Leap Day?” before continuing with the lab.
    6·1 answer
  • Doctrine Creative is a video production company with its own file server within its business office. The company needs to be abl
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!