1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
MissTica
3 years ago
8

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.
(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.
(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.
(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.
while (arrowHeadWidth <= arrowBaseWidth) { // Prompt user for a valid arrow head value }
Example output for arrowBaseHeight = 5, arrowBaseWidth = 2, and arrowHeadWidth = 4:
Enter arrow base height: 5 Enter arrow base width: 2 Enter arrow head width: 4
**
**
**
**
**
****
***
**
*
#include
int main(void) {
int arrowBaseHeight;
int arrowBaseWidth;
int arrowHeadWidth;
printf("Enter arrow base height:\n");
scanf("%d", &arrowBaseHeight);
printf("Enter arrow base width:\n");
scanf("%d", &arrowBaseWidth);
printf("Enter arrow head width:\n");
scanf("%d", &arrowHeadWidth);
printf("\n");
// Draw arrow base (height = 3, width = 2)
printf( "**\n");
printf( "**\n");
printf( "**\n");
// Draw arrow head (width = 4)
printf( "****\n");
printf( "***\n");
printf( "**\n");
printf( "*\n");
return 0;
}

Computers and Technology
1 answer:
andreyandreev [35.5K]3 years ago
6 0

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.

You might be interested in
Ok.,so i have a sopitify account and by accident i pressed the downlaod on button and it says start you free trial i pressed tha
Rudiy27
Just cancel the trial.
6 0
2 years ago
Read 2 more answers
Convert octal number 2470 to decimal number
Vikki [24]
In decimal it is:
0*8^0 + 7*8^1 + 4*8^2 + 2*8^3 = 1336

Basically adding up the place values.
3 0
3 years ago
Read 2 more answers
There are about what licensed drivers here in Florida
arsen [322]
 There are about 15,000,006
6 0
2 years ago
How does 5G technology enhance the Internet of Things (IoT)?
SashulF [63]

Answer:

<em><u>5G Will Quickly Become The New Standard For Cellular Networks. The Internet of Things (IoT) is rapidly developing and expanding. ... 5G will increase cellular bandwidth by huge amounts, making it much easier for the Internet of Things to network large numbers of devices together.</u></em>

Explanation:

Hope its help

5 0
2 years ago
The transitions between slides in a presentation are one type of powerpoint ____.
slava [35]
The transitions between slides in a presentation are one of type of power point 
Animation.
Animation is a set of effects which can be applied to objects in power point  so that they will animate in the slideshow power point.motion paths allow objects to move around the slide show.
4 0
2 years ago
Other questions:
  • Write the interface (.h file) of a class ContestResult containing: An data member winner of type string, initialized to the empt
    14·1 answer
  • Please help
    5·1 answer
  • Ports on the motherboard can be disabled or enabled in ____ setup. RAM Firmware Northbridge BIOS
    8·1 answer
  • Convert to octal. Convert to hexadecimal. Then convert both of your answers todecimal, and verify that they are the same.(a) 111
    12·1 answer
  • Your supervisor has asked you to set up a RAID hard drive array in a tower system, which has a motherboard that uses the B360 ch
    10·1 answer
  • Blank are back and forth movement of matter that create sound​
    15·1 answer
  • What your computer can do to you?
    14·2 answers
  • Calculate The Average of Grades Instructions:
    8·1 answer
  • Write an expression in Boolean algebra that evaluates to 1 when an odd number of bits of the number is 1 and 0 otherwise
    14·1 answer
  • The Linux tail command prints the last maximum n lines of a file. When writing a function that performs this function, choose th
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!