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
larisa [96]
3 years ago
14

Create a 4x5 matrix with ones everywhere and zeros on the last row.

Computers and Technology
1 answer:
Stells [14]3 years ago
7 0

Answer:

#include <iostream>

using namespace std;

int main() {

   int a[4][5];//declaring a matrix of 4 rows and 5 columns.

   for(int i=0;i<4;i++)

   {

       for(int j=0;j<5;j++)

       {

           if(i==3)//initializing last row as 0.

           {

               a[i][j]=0;

           }

           else//initializing last row as 1.

           {

               a[i][j]=1;

           }

       }

   }

   for(int i=0;i<4;i++)

   {

       for(int j=0;j<5;j++)

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

       cout<<endl;

   }

return 0;

}

Output:-

1 1 1 1 1  

1 1 1 1 1  

1 1 1 1 1  

0 0 0 0 0

Explanation:

I have created a matrix of size 4 rows and 5 columns.I have used for loops to fill the array.To fill the last row with 0 i have used if statement.else we are filling it with 1.

You might be interested in
PYTHON:Given the dictionary, d, find the largest key in the dictionary and associate the corresponding value with the variable v
lapo4ka [179]

di = {5: 3, 4: 1, 12: 2}

val_of_max = di[max(di)]

print(val_of_max)

I hope this helps!

4 0
3 years ago
Gps has fostered many benefits in our society, but have also added some risks. What is a risk of gps?
kozerog [31]

GPS is a global positioning system that tells direction and routes. Some risks that come along with GPS are inaccuracy, distraction, and lack of knowledge.

<h3>What is GPS?</h3>

GPS is a radio navigation system based on the satellite and is used to navigate the directions with the help of the signals. Though it has many benefits also has disadvantages. It sometimes does not show accurate routes and direction that is too long.

The navigation system causes distraction during driving and may cause an accident. Too much reliance on GPS causes a lack of knowledge in remembering the directions and places. It may sometimes lead to crime as the saved information and be leaked.

Therefore, GPS has advantages and disadvantages too.

Learn more about GPS here:

brainly.com/question/6905079

#SPJ4

5 0
2 years ago
J=2
leonid [27]

Answer:

yup

tthast right

Explanation:

5 0
3 years ago
A document repository is down when you attempt to access it. which isa principle is being violated?
Tju [1.3M]
When a document repository is down when you attempt to access it, the ISA principle Authentication is being violated. The authentication method is done during the log on phase and is performed by the ISA server which requests certificate. <span>The client then needs to send the appropriate client certificate to the server in order to be authenticated and to have access to the document.</span>
3 0
3 years ago
A previously saved labels report can be accessed from the
Tcecarenko [31]

C. is the answer to that question

6 0
3 years ago
Other questions:
  • Problem 2 (40 points)-Write a program. Submit a file named weight.cpp Create a program that continuously allows a user to enter
    5·1 answer
  • If there is no index.html file in the root folder nothing will be displayed when you navigate to the site address
    14·1 answer
  • A virus has attacked your hard drive and now when you start up Windows, instead of seeing a Windows desktop, the system freezes
    9·2 answers
  • William found out that someone used his report on American culture without his permission. What is William a victim of? A. plagi
    7·2 answers
  • RFID tags uses memory that is read-only.A. TrueB. False
    5·1 answer
  • I need help on this ASAP, worth 93 points
    6·2 answers
  • What can cause a Lenovo computer to be very slow right after after turning it on?
    14·1 answer
  • ______involves encoding information using fewer bits than the original representation Group of answer choices
    6·1 answer
  • Memory cache is referred to as ______. A. SRAM c. SROM b. DRAM d. DROM
    11·1 answer
  • having your online class there's a lot of hazards and risk you may encounter while using gadget PC or Laptop whar do you usually
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!