Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

2nd Edition

1597499471, 978-1597499477

More Books

Students also viewed these Databases questions

Question

What is electric dipole explain with example

Answered: 1 week ago

Question

What is polarization? Describe it with examples.

Answered: 1 week ago