Question: Write a C++ program to visually display the powers of 2. The program is to ask the user to enter a positive integer (which represents

 Write a C++ program to visually display the powers of 2.

Write a C++ program to visually display the powers of 2. The program is to ask the user to enter a positive integer (which represents the desired power of 2). The program then outputs on succes- sive rows the required number of *'s starting with one single * in the first row ( representing 2 = 1 ), two *'s in the second row ( representing 21 = 2), four *'s (representing 22 = 4) in the third row, etc. until the required number of rows have been printed. Typical program interaction would be similar to (values entered from the keyboard by the user are indicated in holdfont in the below examnles)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!