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
___ is a form of electronic money that is decentralized and whose transactions are encrypted, processed, and recorded via peer-t
Tomtit [17]

Answer:

Crytocurrency

Explanation:

8 0
2 years ago
Read 2 more answers
X = 9 % 2if (x == 1):  print ("ONE")else:  print ("TWO")
IgorC [24]

Answer:

ONE

Explanation:

It prints one because % is modulus, which is remainder division. It divides the numbers provided and returns the remainder of the division. 9 / 2 = 4 with 1 remainder, which leads us to our answer.

4 0
1 year ago
The file containing the definitions of the member functions of class DateType is called the ______ file.
Free_Kalibri [48]

Answer:

Implementation file

Explanation:

In popular object oriented programming languages like C/C++, The implementation file (source file) of a class is used to hold the code implementaion of the method(s) of the class, this is helpful for seperating interface and method implementation. When this seperation exists, header files will be used to declare all the methods and fields of the class.

In this way, the implementaion file will hold the actual source code of the methods that are declared in the header file and will have a line to include its associated header file. A major advantage of seperating code in this way is the enhancement of better code organization and code re-use

6 0
3 years ago
Chunking is a good strategy for completing large assignments because it makes the work
Bess [88]

Answer:

ExChunking is a good strategy for completing large assignments because it makes the work

less boring.

more thorough.

less difficult.

more manageable.planation:

Explanation: less difficult (C)

8 0
3 years ago
Read 2 more answers
What class of attacks use innovative attack tools and once a system is infected it silently extracts data over an extended perio
KatRina [158]

Answer:

Advanced persistent threat.

Explanation:

Advanced persistent threat is a threat actor implemented by either a government supported or private group to intrude a network or system and stays undetected, collecting information over a period of time.

It is used by cyber terrorist group to facilitate massive attacks based on the information retrieved. National or government group use the concept to promote national security.

7 0
2 years ago
Other questions:
  • You’ve received a tarball called data79.tar from a colleague, but you want to check the names of the files it contains before ex
    15·1 answer
  • Ray has to type an invoice using the QWERTY keyboard. Along with letters and numbers, he also has to insert the dollar sign. Whi
    13·1 answer
  • How do I attach a file on the computer?
    13·1 answer
  • Your computer is configured to obtain an ipv4 address and dns server address automatically. what utility will help you to find t
    12·1 answer
  • What is the purpose of application software policies?
    12·1 answer
  • Which of the following is true regarding data acquisition? Because data acquisition is often technical, the research team does n
    15·2 answers
  • DTE just installed 500kW of solar capacity on the MCCC campus. the cost of the installation was about $3 million. what was the c
    10·1 answer
  • Some applications required advanced storage solutions are available to provide fault tolerance and high performance.
    13·1 answer
  • If you do a Find and Replace for a term, where will Word begin looking for the term?
    6·1 answer
  • The Western Siberian Plain is __________ in some places because it has poor natural draining systems.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!