Answer:
Here is the C program:
#include <stdio.h> //to use input output functions
int main(void) { //start of main function
int arrowBaseHeight = 0; //stores value for arrow base height
int arrowBaseWidth = 0; //stores value for arrow base width
int arrowHeadWidth = 0 ; //stores value for arrow head width
int i, j; //to traverse through the rows and columns
printf("Enter arrow base height:\n"); //prompts user to enter arrow base height value
scanf("%d", &arrowBaseHeight); //reads input value of arrow base height
printf("Enter arrow base width:\n"); //prompts user to enter arrow base width value
scanf("%d", &arrowBaseWidth); //reads input value of arrow base width
while (arrowHeadWidth <= arrowBaseWidth) { //iterates as long as the value of arrowHeadWidth is less than or equals to the value of arrowBaseWidth
printf("Enter arrow head width:\n"); //prompts user to enter arrow head width value
scanf("%d", &arrowHeadWidth); //reads input value of arrow head width
printf("\n"); }
for (i = 0; i < arrowBaseHeight; i++) { //iterates through rows
for (j = 0; j < arrowBaseWidth; j++) { //iterates through columns
printf("*"); } //prints asterisks
printf("\n"); } //prints a new line
for (i = arrowHeadWidth; i > 0; i--) { //loop for input length
for (j = i; j > 0; j--) { //iterates for triangle ( to make arrow head)
printf("*"); } //prints asterisks
printf("\n"); } } //prints new line
Explanation:
The program asks to enter the height of the arrow base, width of the arrow base and the width of arrow head. When asking to enter the width of the arrow head, a condition is checked that the arrow head width arrowHeadWidth should be less than or equal to width of arrow base arrowBaseWidth. The while loop keeps iterating until the user enters the arrow head width larger than the value of arrow base width.
The loop is used to output an arrow base of height arrowBaseHeight.
The nested loop is being used which as a whole outputs an arrow base of width arrowBaseWidth. The inner loop draws the stars and forms the base width of the arrow, and the outer loop iterates a number of times equal to the height of the arrow.
The last nested loop is used to output an arrow head of width arrowHeadWidth. The inner loop forms the arrow head and prints the stars needed to form an arrow head.
The screenshot of output is attached.