Question: Print isosceles triangles. For each triangle, allow the user to input two values: a character to be used for printing the triangle and the size
Print isosceles triangles. For each triangle, allow the user to input two values: a character to be used for printing the triangle and the size of the peak for the triangle. Test the input for valid characters. The size of the triangle should not be larger than 10.
If an invalid non-numeric character is entered for size or if the value entered for size is larger than 10, use 3 as the default value. If an invalid entry is entered for the character, use an asterisk ( * ) as the default character. Allow multiple triangles to be printed. For example, if the user inputs # for the character and 6 for the peak, you should produce the following display:
#
# #
# # #
# # # #
# # # # #
# # # # # #
# # # # #
# # # #
# # #
# #
#
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
