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
vodomira [7]
2 years ago
6

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. #include int main(void) {int arrowBaseHeight = 0;int arrowBaseWidth = 0;int arrowHeadWidth = 0;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;}a. Modify the given program to use a loop to output an arrow base of height arrow_base_height. b. Modify the given program to use a loop to output an arrow base of width arrow_base_width.c. Modify the given program to use a loop to output an arrow head of width arrow_head_width.

Computers and Technology
1 answer:
stira [4]2 years ago
8 0

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.

You might be interested in
Considering the traffic problem, do you think Rod handled the situation well?
svet-max [94.6K]
No he did not that was a poor choice.
7 0
3 years ago
In the line of code shape ("classic") which part of the code is the argument
Mekhanik [1.2K]
Whatever is in the parenthese
5 0
3 years ago
Read 2 more answers
Which of the following is the single best rule to enforce when designing complex passwords?
saw5 [17]

Answer:

B. Longer passwords

Explanation:

If the password is longer, it requires more incorrect attempts to find it, so the system could identify a potential hacker attempt. Smaller but more complex passwords could be identified by mistype or forgotten passwords.

3 0
3 years ago
One or more messages about the same topic is a ?
elena55 [62]

Answer:

This is the case of redundancy or the repeated data. It means that the same data is being repeated again and again. And its the wastage of time and memory both. The redundancy must be removed in all circumstances. However, we cannot as without it proper normalization of data is not possible.

Explanation:

The answer is self explanatory.

6 0
3 years ago
A new object of type list is created for each recursive invocation of f.A. TrueB. False
sammy [17]

Answer:

True but double check!

7 0
2 years ago
Other questions:
  • Troubleshooting comes before diagnosing. Answer: false
    7·1 answer
  • When you right-click certain areas of the Word or other Office app windows, a command menu will appear. Group of answer choices
    13·1 answer
  • Complete function PrintPopcornTime(), with int parameter bagOunces, and void return type. If bagOunces is less than 3, print "To
    9·1 answer
  • Write a program that asks the user for two file names. The first file will be opened for input and the second file will be opene
    8·1 answer
  • How does the text recommend that a company operate if it wants to be successful in the information age?
    11·1 answer
  • How major is the technology problem in the United States?
    15·1 answer
  • Do you know how to change your grades on a printer???????????
    13·1 answer
  • What does a hanging indent look like?
    7·1 answer
  • Does "remainder of x from y" mean xmody?
    5·1 answer
  • Have the javascript function CountingMinutes(str) take the str parameter being passed which will be two times (each properly for
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!