Question: in C Write a program to display 2 right triangles - one with the base on the bottom and the hypotenuse on the right, and

in C Write a program to display 2 right triangles - one with the base on the bottom and the hypotenuse on the right, and one with the base at the top and the hypotenuse on the left.
(1) Ask the user for a number between 1 and 15 for the size of the base of the triangles. (1 pt)
Enter the size of the base for the triangles (1-15): 4
(2) Validate that the number entered is between 1 and 15 inclusive, and if not inform the user and re-ask for the number until a number in the correct range is entered. (3 pts)
Create constants for the minimum (1) and the maximum (15) numbers, and use the constants in the prompts, the validation condition, and the validation error message.
Enter the size of the base for the triangles (1-15): 20 The base of the triangles must be between 1 and 15- Please re-enter. Enter the size of the base for the triangles (1-15): 4
(3) Display a right triangle with the base on the bottom and the hypotenuse on the right, using the character 'X'.(3 pts)
Enter the size of the base for the triangles (1-15): 4 Base at bottom - Hypotenuse on right X XX XXX XXXX
(4) Display a second right triangle with the base on the top and the hypotenuse on the left, using the character 'X' and spaces. (3 pts)
Enter the size of the base for the triangles (1-15): 4 Base at bottom - Hypotenuse on right X XX XXX XXXX Base at top - Hypotenuse on left XXXX XXX XX X

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!