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
PIT_PIT [208]
3 years ago
11

Write a program that generates two 3x3 matrices, A and B, withrandom values in the range [1, 100] and calculates the expression½

A + 3B
Computers and Technology
1 answer:
Alex3 years ago
6 0

Answer:

#include <bits/stdc++.h>

using namespace std;

int main() {

int A[3][3],B[3][3],res[3][3],i,j;

srand(time(0));//for seed.

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

{

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

{

   int val=rand()%100+1;//generating random values in range 1 to 100.

   int val2=rand()%100+1;

   A[i][j]=val;

   B[i][j]=val2;

}

cout<<endl;

}

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

{

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

   {

       res[i][j]=0.5*A[i][j]+3*B[i][j];//storing the result in matrix res.

   }

}

cout<<"Matrix A is"<<endl;

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

{

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

   {

       cout<<A[i][j]<<" ";//printing matrix A..

   }

   cout<<endl;

}

cout<<"Matrix B is"<<endl;

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

{

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

   {

       cout<<B[i][j]<<" ";//printing matrix B..

   }

   cout<<endl;

}

cout<<"The result is"<<endl;

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

{

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

   {

       cout<<res[i][j]<<" ";//printing the result..

   }

   cout<<endl;

}

return 0;

}

Output:-

Matrix A is

13 95 83  

88 7 14  

24 22 100  

Matrix B is

11 13 95  

48 35 20  

68 100 18  

The result is

39.5 86.5 326.5  

188 108.5 67  

216 311 104  

Explanation:

I have created 2 matrices A and B and storing random numbers int the matrices A and B.Then after that storing the result in res matrix of type double to store decimal values also.Then printing the res matrix.

You might be interested in
Advanced Sounds is engaging in a full upgrade of its Windows Server 2003 network to Windows Server 2008. The upgrade includes us
Lynna [10]

Answer:

cs

Explanation:

5 0
3 years ago
A computer hacker trying different combinations of characters to crack a password is a ________.
Natalka [10]

Answer:

Brute force attack

Explanation:

it happens when hackers try different combos of characters to guess a password in a short amount of time

5 0
2 years ago
Read 2 more answers
Which phrases or sentences in the passage denote operations that the hospital carries out with the help of computers?
Schach [20]
Here are the phrases or sentences that show operations that the hospital functions with the aid of computers:
-<span>As soon as he was admitted, the hospital authorities recorded David's medical history. (Medical Histories are often encoded in the computers to serve as records for future references.)
-</span><span>David was then placed in an Intensive Care Unit (ICU), where his vital signs were constantly monitored. (Here, these machines were connected to the computers in order to take note of his vital stats.)</span>
3 0
4 years ago
Read 2 more answers
Schematic diagrams tell electricians where the _______ must come from either to open or close contacts.
sergeinik [125]
The answer is A I hope you get it right!
6 0
3 years ago
Computer network reduces the cost. explain the statement with example.​
Crank

Answer:

Justify this statement with an example. Ans: Computer Network reduces expenses of an office because computer on a network share different hardware devices like printers, scanners, hard disk etc. And sharing those hardware devicAes will reduces the expense of an office.

Explanation:

Justify this statement with an example. Ans: Computer Network reduces expenses of an office because computer on a network share different hardware devices like printers, scanners, hard disk etc. And sharing those hardware devicAes will reduces the expense of an office.

3 0
3 years ago
Other questions:
  • Rachel is on her way to an interview for the position of a project manager. She is trying to prepare for this interview by analy
    6·1 answer
  • Why is the Vigenere cipher hard to crack? (select 2)
    6·1 answer
  • You are in a library to gather information from secondary sources, and you want to find a current print resource that can supple
    6·1 answer
  • 1. Write a method isMultiple that determines, for a pair of integers, whether the second integer is a multiple of the first. The
    12·1 answer
  • Does learning swift is hard? more than android?
    13·1 answer
  • Please answer the following essay question:
    13·1 answer
  • This is your code.
    9·1 answer
  • You are purchasing a new printer. Which of the following is the most important requirement?
    5·1 answer
  • Which is not and input device , keyboard , joystick, Monitor, Microphone​
    10·2 answers
  • How do technologies such as virtual machines and containers help improve
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!