Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please be aware that it's not the row of the diamond but the diagonal length. Thank You ! And please answer in c++, only in

image text in transcribed

Please be aware that it's not the row of the diamond but the diagonal length. Thank You !

And please answer in c++,

only in needed, please use for_loop, while_loop, do-while_loop only(i.e. cannot use function)

Test cases:

Enter the diagonal length: 9 ----* ---*** --***** -******* ********* -******* --***** ---*** ----*

The test case above, the '-' indicates the spacing only, expected output should not include '-' Real expected output:

Enter the diagonal length:

9 * *** ***** ******* ********* ******* ***** *** *

Write a program to print a diamond with a specified size using asterisks (). The program receives an odd positive integer as the diagonal length of the diamond, which represents the number of asterisks () in the middle row. As diamonds are symmetric, the number of asterisks () in rows from top to bottom should be 1,3,5...5,3,1. Expected output is as follows: Expected Outcomes: NOTE: The input is required to be odd positive integers. Validity check should be provided

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

Students also viewed these Databases questions

Question

What will you do or say to Anthony about this issue?

Answered: 1 week ago