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
User-system interaction is?
Mandarinka [93]
A multidisciplinary, post-Master<span> educational program which provides practical training in the field of </span>human-computer interaction and user interface design<span>.</span>
8 0
3 years ago
For what show did the actor, whose star is located at 6667 Hollywood Boulevard, earn an Emmy Award for Outstanding Supporting Ac
Ilya [14]

The show’s title is China Beach, which was a television series set in a hospital during the Vietnam War. It was aired from 1988 to 2001. The actress who won a Primetime Emmy Award for Outstanding Supporting Actress in a Drama Series was Marg Helgenberger. She won in 1990 for her role as a part-time prostitute who is also a volunteer, Karen Charlene "K.C." Koloski.  


4 0
2 years ago
Read 2 more answers
A customer comes into a grocery store and buys 8 items. Write a PYTHON program that prompts the user for the name of the item AN
Dmitrij [34]

Answer:

name = []

price = []

for i in range(0,8):

item_name = input('name of item')

item_price = input('price of item')

name.append(item_name)

price.append(item_price)

for i in range(0, 8):

print(name[i], '_____', price[i])

Explanation:

Python code

Using the snippet Given :

Apples 2.10

Hamburger 3.25

Milk 3.49

Sugar 1.99

Bread 1.76

Deli Turkey 7.99

Pickles 3.42

Butter 2.79

name = []

price = []

#name and price are two empty lists

for i in range(0,8):

#Allows users to enter 8 different item and price choices

item_name = input('name of item')

item_price = input('price of item')

#user inputs the various item names and prices

#appends each input to the empty list

name.append(item_name)

price.append(item_price)

for i in range(0, 8):

print(name[i], '_____', price[i])

# this prints the name and prices of each item from the list.

3 0
2 years ago
Identifying the problem is crucial when trying to solve a problem. There are several techniques that you can use to aide you in
erica [24]
Consensus Building is NOT a technique that you can use to help you in identifying a problem.
8 0
3 years ago
In which generation of computers are we in?​
qwelly [4]
It should be the Sixth generation
4 0
3 years ago
Other questions:
  • Which component is the smallest unit in a spreadsheet?
    14·2 answers
  • What is the maximum number of hosts you can have on a network if the first decimal value of the ip address is between 192 and 22
    10·1 answer
  • What are 2 plants that grow best in our soil type ​
    9·1 answer
  • As photography developed, a variety of materials were employed as image capture surfaces. Choose the correct order
    7·1 answer
  • The parameter passing mechanisn used in C is
    5·2 answers
  • Jemima is reviewing her history report and notices that her headings are not formatted the same throughout the
    7·1 answer
  • What is the decrypted binary
    9·1 answer
  • Write 3 things that can't be done without technology.
    14·2 answers
  • Explain why the receptionist responded as indicated in the following scenario.
    8·1 answer
  • Assignment 1:
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!