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
ryzh [129]
3 years ago
13

Write a C++ programthat reads in the side of a square and prints out a pattern on$

Computers and Technology
1 answer:
AnnZ [28]3 years ago
7 0

Answer:

#include<iostream>

using namespace std;

//main function

int main(){

   //initialize the variables

   int side;

   //print the message

   cout<<"Please enter the side of square: ";

   cin>>side;  //read the vale and store in the variable.

   // for loop

   for(int i=1;i<=side;i++){  //lop for rows

       for(int j=1;j<=side;j++){   //loop for column

           cout<<"$";  //print the '*'

       }

       cout<<endl;

   }

}

Explanation:

Create the main function and declare the variable side.

print the message on the screen for the user and then store value enter by the user on the variable side.

take the nested for loop for print the pattern.

nested for loop means, loop inside another loop it is used for print the pattern having rows and columns.

the first loop updates the row number and the second the loop print the character '$' in the column-wise.

in the code,

if i = 1, for loop check the condition 1 <= 5 if the value of side is assume 5.

condition is true and the program moves to the second for loop and starts to print the character '$' five times after that, print the new line.

then, the above process repeat for different rows and finally, we get the pattern in square shape.

You might be interested in
To add artwork to a slide, the slide must contain a placeholder. <br> a. True <br> b. False
valina [46]
The answer is True.  To add artwork to a slide, the slide must contain a placeholder. <span>Once </span>artwork<span> is inserted into a </span>placeholder<span>, it can be moved around the </span>slide<span>.</span>
5 0
4 years ago
Which of the following statements is false? a. Racks and bins are examples of storage equipment. b. Automation refers to equipme
svp [43]

Answer:

b. Automation refers to equipment that complements, rather than replaces, human contact.

3 0
4 years ago
To track what level a player is on, you can create a simple variable and a block saying change level by 1 attached to the when g
marishachu [46]

Answer:

False

Explanation:

I did it on edgnuity also i got it right

5 0
3 years ago
What is it called when a user makes a typing error when entering a url that takes him to an imposter website?
Shtirlitz [24]
It’s called a typo squatting
6 0
3 years ago
If you have a Gmail account, you automatically have a Google+ account
Korolek [52]
The statement above is TRUE.
According to Google operating system, new users who signed up for google account will automatically get a gmail and google plus accounts. User can later delete the google plus account if they are not interested in it.
5 0
3 years ago
Other questions:
  • _____ is the network protocol that deals with the routing of packets through interconnected networks to the final destination.
    9·1 answer
  • Which of the following statements about these signs is true?
    13·1 answer
  • A tripod head can move vertically or horizontally. What term describes these movements?
    15·2 answers
  • A telephone repair technician uses a meter to measure voltage on a phone line. This meter is an example of _____.
    10·2 answers
  • What is the most likely result of a correctly installed processor, but an incorrectly installed cooler?
    6·1 answer
  • Examine the following algorithm.
    9·1 answer
  • Can anyone fill in the space please
    6·1 answer
  • Which of the following would be considered hardware? Select 3 options.
    7·1 answer
  • State four reasons why office automation is adopted in business establishment?​
    7·1 answer
  • Which of these could you use to change data into information?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!