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
software that instructs the computer how to run applications and controls the display/keyboard is know as the___.
kakasveta [241]
The answer is the alu arithmetic logic unit.
8 0
3 years ago
Help!! Best answer will get Brainliest!!
Eddi Din [679]

Answer:

answer(s):

-set goals

-select a topic

-write down research questions

Hope this helped and sorry for the bold. <3

Explanation:

6 0
2 years ago
Read 2 more answers
Instructions:Select the correct answer.
lana [24]
You should follow A. Alternate between single and horizontal line breaks, and B. update your resume on job sites once a year, so that you can tell the people who look at the resume what skills you have updated on.
6 0
3 years ago
4. When inserting clip art into a page of text, which of the following is true? (1 point)
ella [17]
I would vote for D since you can adjust picture positioning and wrapping. A is BS, B and C are not true.
8 0
2 years ago
Read 2 more answers
Which formula is a simple formula?<br> O =E10/5+1<br> 0 -5+A1*B1<br> O =C3+10-E3<br> 0 =10-(A3-D13)
steposvetlana [31]

Answer:

O =C3+10-E3

Explanation:

Only addition and subtraction :D

8 0
2 years ago
Other questions:
  • RFID can be used for all of the following applications except:_________.
    15·1 answer
  • Write a complete Java method that returns an integer. The method declares a Scanner object, then prompts the user for a series o
    12·1 answer
  • How to write a function that counts the letters in a string in C?
    13·1 answer
  • Write a program in python to test if given number is prime or not.
    6·2 answers
  • Yuri, a medical assistant, has been asked to send an account of a patient's last office visit to another doctor's office. The te
    6·2 answers
  • Some commands listed in a menu cannot be selected.<br><br><br> True or False
    13·2 answers
  • Which of the following will print I'VE GOT THIS on the screen? (5 points)
    14·1 answer
  • 4.2 lesson practice help plzs
    6·1 answer
  • What is pseudo code?
    11·2 answers
  • _____ oversee the work of various types of computer professionals and must be able to communicate with people in technical and n
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!