Question
c++ Write a program that reads a positive odd whole number n and prints a pyramid where the last row contains all numbers from n
c++
Write a program that reads a positive odd whole number n and prints a pyramid where the last row contains all numbers from n down to 1 (i.e., descending order), the second to last row displays all numbers from n 1 down to 2, the third to last row displays all numbers from n 2 down to 3, etc. The first row will contain only a single value, i.e. the middle value in the range, i.e. n down to 1. Each successive row contains two more values than the previous row. Note: the Pyramid of digits should not be in the middle of the page but on the left-most side.
For example, if n is 9, then the program will output: 654 7 65 43 87 654 32 9 8765 4321 If n is 13, then the program will output: 876 98765 0987 654 109 876543 210 987 65 432 32 109 8765 4321
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started