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]
3 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]3 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
2. Sanjay thinks it's okay to plagiarize because he thinks his instructors won't find out. However, it's
Tatiana [17]
The correct answer is B
8 0
3 years ago
Andrew is using a word processing application to type out his résumé. Which of the following change happens "on the fly" as he t
TiliK225 [7]

On the fly refers to<u> something that is being changed while a process is still ongoing. </u>

In a word processing application, what is more likely to happen is (B) it highlights grammatically incorrect sentences. This would occur since Microsoft Word default settings would be to do this. The other options would not occur automatically; the user needs to intentionally pick to do them.

3 0
4 years ago
Which backup requires a small amount of space and is considered to have an involved restoration process?
dusya [7]

Incremental backup needs a small amount of space and exists considered to have an involved restoration process.

<h3>What is Incremental backup?</h3>

A backup or data backup exists as a copy of computer data taken and stored elsewhere so that it may be utilized to restore the original after a data loss event. The verb form, directing to the process of doing so, exists as "back up", whereas the noun and adjective form is "backup".

An incremental backup exists a backup type that only copies data that has been changed or made since the previous backup activity was conducted. An incremental backup approach exists used when the amount of data that has to be protected stands too voluminous to do a full backup of that data every day.

An incremental backup exists one in which successive copies of the data contain only the portion that has been modified since the preceding backup copy was made. When a full recovery is required, the restoration process would require the last full backup plus all the incremental backups until the point of restoration.

Hence, Incremental backup needs a small amount of space and exists considered to have an involved restoration process.

To learn more about Incremental backup refer to:

brainly.com/question/17330367

#SPJ4

6 0
2 years ago
Help please lol...
Neko [114]

Answer:

cutaway shots are put in to help the editing process, and to provide extra information or interest

Explanation:

8 0
3 years ago
Read 2 more answers
Write a function called sum_first_integers that takes a single positive integer parameter. The function should also return a pos
sashaice [31]

Answer:

def sum_first_integers(n):

       if n <= 0 or type(n) != int:

               raise ValueError('Value must be a positive integer greater than 0')

       total = 0

       for num in range(1, n+1):

               total += num

       return total

Explanation:

The above function was written in Python, the first if statement is for validation purposes and it ensures that the argument passed is a positive integer. If it is not, a ValueError is raised

We leveraged on Python's range function, which accepts three arguments although we passed in two arguments. The first argument is where the range function will start from and the second is where it will end. If we want the range function to stop at value n, then the argument has to be n+1(This is because machine starts counting numbers from 0) and the last argument is the step in which the increment is done. If no value is passed to this argument, Python assumes the value to be 1 which is what is done in this case.

Hence range(1, 5) = (1,2,3,4) and range (2, 10, 2) = 2,4,6,8

6 0
4 years ago
Other questions:
  • Two fingers are assigned to six letters each. What fingers are they?
    9·1 answer
  • Indicate whether the scenario below is safe or unsafe : when storing a flammable liquid, you decide to separate it from other ma
    9·1 answer
  • The domain in an email message tells you what?
    11·1 answer
  • Refers to the programs or instructions used to tell the computer hardware what to do.
    8·1 answer
  • CJ is developing a new website blogging about cutting-edge technologies for people with special needs. He wants to make the site
    8·1 answer
  • Welcome back to school people!
    15·2 answers
  • taking small bits of information from the internet/web and using it as my own work or to complete an assignment is plagiarism.
    6·1 answer
  • Difference between hardcopy and hardware​
    6·1 answer
  • What is phishing?
    14·1 answer
  • What is the most common way to obtain new software?.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!