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
I need help with this plz question 2 and 3 asap
Lena [83]

I an not sure what you want me to do so I am going to help you on both of these problems:

Question 2 answer: I think the answer is University/industry interaction

Question #3 answer: I think the answer for this is clearly written in the question (i think that the second answer choice is it)

I am not sure what this is but i am only in the 10th grade!!!! the only class that I took last year was Computer Fundumentals

Btw I am in K12 as well :)

4 0
3 years ago
Please describe the role of games in modern society!
ohaa [14]
It is to Entertainment.
5 0
2 years ago
Read 2 more answers
What is the difference between ‘’ and “” string type in python?
Mekhanik [1.2K]

Answer:

There is no difference between ‘’ and “” string type in python. Both are used to hold the string or sequence of character in the python. triple """ """ can also use for the same.

Example:

str1 = "aeiou"

str2 = 'aeiou'

str3 =""" hello"""

print(type(str1), type(str2),type(str3))

<class 'str'> <class 'str'> <class 'str'>

Here all are used to hold string or sequence of character.

6 0
3 years ago
What is a banner grab?
alexira [117]
Banner Grabbing is a technique used to gain information about a computer system on a network and the services running on its open ports. Administrators can use this to take inventory of the systems and services on their network.

Hope you find this helpful!
Brainliest and a like is much appreciated!
3 0
2 years ago
You can include up to _____ logical conditions in the and function.
Margaret [11]
You can include up to 255 logical conditions in the AND function. This is to test multiple<span> conditions at the same time.
</span><span>The syntax of the AND function is the following: =AND (logical1, [logical2], ...)</span><span>
The AND function can be true (one) and false (null), only one of these two values.
</span><span>The AND function will return #VALUE if no logical values are found or created during evaluation.</span>
5 0
3 years ago
Other questions:
  • Compare GBN, SR, and TCP (no delayed ACK). Assume that the timeout values for all three protocols are sufficiently long such tha
    7·1 answer
  • The graph of which function has an axis of symmetry at x=-1/4​
    15·1 answer
  • Pros and cons of access to a wide range of online services when it comes to an individual's safety?
    14·1 answer
  • Stealing passwords by using software code to run through various password schemes with numbers, symbols, capital letters, and ch
    6·1 answer
  • Arrays are described as immutable because they are two dimensional. are arranged sequentially. can be reordered. cannot be chang
    13·1 answer
  • Kiera is building a new computer and wants to make sure she has an adequate power supply for all the new equipment she is purcha
    15·2 answers
  • What major criteria must a product or process meet in order to be considered emerging technology?
    6·1 answer
  • How many strings with five or more characters can be formed from the letters in seeress?
    15·1 answer
  • Write a program to accept 10 different whole number from the user and store them in a
    11·1 answer
  • How does the use of blocking affect the external sorting algorithm, and how does it change the cost formula
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!