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
What is a dynamic CMOS circuit?
dybincka [34]

Answer:

Dynamic circuit class, which relies on temporary storage of signal values on the capacitance of high- impedance circuit nodes. In this section, an alternate logic style called dynamic logic is presented that obtains a similar result, while avoiding static power consumption.

Explanation:

Please Mark me brainliest

6 0
3 years ago
Which statement is most true about computers today?
Olegator [25]

Answer:

I think it's B because it can't be any other

4 0
2 years ago
Read 2 more answers
Pls do not press any links by Fleetstreet186, they are dangerous malware! If you see any of his links report it pls!
Hitman42 [59]

Hello!

Thanks, for warning us. :) and I will be aware of Fleetstreet186, Plus, I will report his links if I see them!

Have a great day!

#LearnWithBrainly

Answer:

Jace~

Plus, here is the anime image that might make your day happy. . .

3 0
3 years ago
Read 2 more answers
Which mobile game do play most pubg or call of duty mobile ​
Katena32 [7]

Answer:

Neither game, does anyone remember Angry Birds Epic though

Explanation:

That game brings me nostalgia

6 0
3 years ago
Read 2 more answers
6. The
nordsb [41]

In spermatocytogenesis, a diploid spermatogonium, which resides in the basal compartment of the seminiferous tubules, divides mitotically, producing two diploid intermediate cells called primary spermatocytes.

Fertilization takes place in the fallopian tubes, which connect the ovaries to the uterus. Fertilization happens when a sperm cell successfully meets an egg cell in the fallopian tube.

7 0
4 years ago
Other questions:
  • Which of the following syntaxes displays a dialog box, causing the user to enter input text?
    8·1 answer
  • Which feature does the web designer fail to apply in this layout for a web page? A. harmony
    8·2 answers
  • Steve adds a second 1-GB 240-pin DIMM to his PC, which should bring the total RAM in the system up to 2GB. The PC has an Intel C
    9·1 answer
  • What factors should you consider when buying a hard drive?
    8·1 answer
  • Dell is an American corporation that deals with computer technology. With its worldwide sourcing and fully merged production and
    6·1 answer
  • Which of the following demonstrates the proper way to specify a variable-length argument list?
    7·1 answer
  • Create two Lists, one is ArrayList and the other one is LinkedList and fill it using 10 state names (e.g., Texas). Sort the list
    6·1 answer
  • A __________ note is a private note that you leave for yourself or for other people who might use the presentation file
    9·1 answer
  • What was Bill Gates purpose for starting a business?
    12·1 answer
  • dion training just installed a new webserver within a screened subnet. you have been asked to open up the port for secure web br
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!