Write a program that inputs an odd number from 1 to 35 and prints a diamond of a
ID: 3617418 • Letter: W
Question
Write a program that inputs an odd number from 1 to 35 and prints a diamond of asterisks.
You may only use output statements that print a single asterisk (*) or a
single blank. q6ximize the use of repetition with nested for loops and
minimize the number of output statements.
Check the input to make sure it is not an even number nor it is outside
the range. Use do...while to ensure acceptable input value.
Expected Output:
Enter an odd number for rows (1 to 35) for the diamond of asterisks : 22
22 is not an odd number. Please re-try.
Enter an odd number for rows (1 to 35) for the diamond of asterisks : -4
-4 is outside the range. Please re-try.
Enter an odd number for rows (1 to 35) for the diamond of asterisks : 39
39 is outside the range. Please re-try.
Enter an odd number for rows (1 to 35) for the diamond of asterisks : 5
*
***
*****
***
*
Enter an odd number for rows (1 to 35) for the diamond of asterisks : 23
*
***
*****
*******
*********
***********
*************
***************
*****************
*******************
*********************
***********************
*********************
*******************
*****************
***************
*************
***********
*********
*******
*****
***
*
Enter an odd number for rows (1 to 35) for the diamond of asterisks : 35
*
***
*****
*******
*********
***********
*************
***************
*****************
*******************
*********************
***********************
*************************
***************************
*****************************
*******************************
*********************************
***********************************
*********************************
*******************************
*****************************
***************************
*************************
***********************
*********************
*******************
*****************
***************
*************
***********
*********
*******
*****
***
*