Iterative statement - construction of Pyramid Write a C++ program print the Pyramid on command line. Choose any two from the list and build the program with for / while loop statements. Half Pyramid Inverted Half Pyramid Hollow Inverted Half Pyramid Full Pyramid Inverted Full Pyramid Hollow Full Pyramid
Added by Victor W.
Close
Step 1
```cpp #include<iostream> using namespace std; int main(){ int rows; cout << "Enter number of rows: "; cin >> rows; for(int i = 1; i <= rows; ++i){ for(int j = 1; j <= i; ++j){ cout << "* "; } cout << "\n"; Show more…
Show all steps
Your feedback will help us improve your experience
Shelayah Robinson and 87 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
(Display a pyramid) Write a program that prompts the user to enter an integer from 1 to 15 and displays a pyramid, as shown in the following sample run:
Write a program that estimates how much Khufu's pyramid in Giza weighs. Your program should assume that every block weighs 2.5 tons. Khufu's pyramid in Giza used around 2,500,000 blocks. You should use two variables: numBlocks and blockWeight, to calculate the weight. Here is an example output for a pyramid that uses 150,000 blocks: The pyramid weighs 375,000.0 tons. Note: Your number should be different!
Supreeta N.
Write a program to print a diamond made up of left- and right-aligned right-angled isosceles triangles, all of positive integer height specified by the user's keyboard input (a positive integer), as follows: Enter triangle height: 6 ************ ***** ***** **** **** *** *** ** ** * * ** ** *** *** **** **** ***** ***** ************
William M.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD