Question: In C Programming This program outputs a downwards facing arrow composed of a rectangle and a right triangle. The arrow dimensions are defined by user
In C Programming
This program outputs a downwards facing arrow composed of a rectangle and a right triangle. The arrow dimensions are defined by user specified arrow base height, arrow base width, and arrow head width.
(1) Modify the given program to use a loop to output an arrow base of height arrowBaseHeight. (1 pt)
(2) Modify the given program to use a loop to output an arrow base of width arrowBaseWidth. Use a nested loop in which the inner loop draws the *s, and the outer loop iterates a number of times equal to the height of the arrow base. (1 pt)
(3) Modify the given program to use a loop to output an arrow head of width arrowHeadWidth. Use a nested loop in which the inner loop draws the *s, and the outer loop iterates a number of times equal to the height of the arrow head. (2 pts)
(4) Modify the given program to only accept an arrow head width that is larger than the arrow base width. Use a loop to continue prompting the user for an arrow head width until the value is larger than the arrow base width. (1 pt)
while (arrowHeadWidth <= arrowBaseWidth) { // Prompt user for a valid arrow head value } This is the given program: #include int main(void) { int arrowBaseHeight = 0; int arrowBaseWidth = 0; int arrowHeadWidth = 0; printf("Enter arrow base height: "); scanf("%d", &arrowBaseHeight); printf("Enter arrow base width: "); scanf("%d", &arrowBaseWidth); printf("Enter arrow head width: "); scanf("%d", &arrowHeadWidth); printf(" "); // Draw arrow base (height = 3, width = 2) printf( "** "); printf( "** "); printf( "** "); // Draw arrow head (width = 4) printf( "**** "); printf( "*** "); printf( "** "); printf( "* "); return 0; } Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
