Answer:
Follows are the modified code to this question:
#include <stdio.h>//defining a herader file
int main(void) //defining a main method
{
int arrowBaseHeight = 0,arrowBaseWidth = 0,arrowHeadWidth = 0 ;//defining integer variable
int i, j; //defining integer variable
printf("Enter arrow base height:");//print message
scanf("%d", &arrowBaseHeight);//input value in arrowBaseHeight variable
printf("Enter arrow base width:");//print message
scanf("%d", &arrowBaseWidth);//input value in arrowBaseWidth variable
while (arrowHeadWidth <= arrowBaseWidth)//defining while loop to check arrowHeadWidth less then equal to arrowBaseWidth
{
printf("Enter arrow head width:");//print message
scanf("%d", &arrowHeadWidth);//input value in arrowHeadWidth variable
printf("\n");//use for line spacing
}
// defining for loop for print vertical line of asterisk
for (i = 0; i < arrowBaseHeight; i++)//defining for loop for print row
{
for (j = 0; j < arrowBaseWidth; j++) //defining for loop for print column
{
printf("*");//print asterisk value
}
printf("\n");//use for line spacing
}
//defining for loop for print reverse triangle
for (i = arrowHeadWidth; i > 0; i--) //defining loop for input length
{
for (j = i; j > 0; j--) //defining loop for triangle
{
printf("*"); //print asterisk value
}
printf("\n");//use for line spacing
}
return 0;
}
Output:
please find attach file.
Explanation:
In the code, inside the method five integer variable "arrowBaseHeight, arrowBaseWidth, arrowHeadWidth, i, and j" is defined, in which the first three variables are used for input value from the user end, and "i and j" are used in the loop.
In the next step while loop is used for input the value, but in this code, mainly two for loop is used which can be defined as follows:
- In the first loop, it is used the "arrowBaseHeight and arrowBaseWidth" variable to print the vertical line of the asterisk.
- In the second loop, it uses the "arrowHeadWidth" variable to print the reverse triangle.