Please create a basic program in C using the following instructions: 11.5 Lab We
ID: 3585580 • Letter: P
Question
Please create a basic program in C using the following instructions:
11.5 Lab Week 6: Drawing a half arrow 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 (arrowHeadwidthExplanation / Answer
SAMPLE OUTPUT
#include<stdio.h>main()
{
// declaring variables
int arrowBaseHeight = 0;
int arrowBaseWidth = 0;
int arrowHeadWidth = 0;
int i, j;
// taking user input
printf("Enter arrow base height: ");
scanf("%d",&arrowBaseHeight);
printf("Enter arrow base width: ");
scanf("%d",&arrowBaseWidth);
printf("Enter arrow head width: ");
scanf("%d",&arrowHeadWidth);
// looping through arrowBaseHeight to have that number of lines
for(i=0;i<arrowBaseHeight;i++)
{
// looping through arrowBaseWidth to have that number of stars in each line
for(j=0;j<arrowBaseWidth;j++)
printf("*");
printf(" ");
}
// looping through arrowHeadWidth to have that number of lines
for(i=0;i<arrowHeadWidth;i++)
{
// looping through arrowHeadWidth to have that number of stars in each line
for(j=0;j<arrowHeadWidth-i;j++)
printf("*");
printf(" ");
}
}
SAMPLE OUTPUT
Enter arrow base height: 5 Enter arrow base width: 2 Enter arrow head width: 4 ** ** ** ** ** **** *** ** *
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.