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
The acronym LAH stands for
Nina [5.8K]
D.Limited Access Highway
5 0
3 years ago
Read 2 more answers
I'm using assembly language. This is my assignment. I kinda confused about how to write code for this assignment. Can anyone exp
Brut [27]

Answer:

oid changeCase (char char_array[], int array_size ) {

__asm{

   mov eax, char_array;    

   mov edi, 0;

readArray:

   cmp edi, array_size;

   jge exit;

   mov ebx, edi;          

   shl ebx, 2;

   mov cl, [eax + ebx];    

check:

   //working on it

   cmp cl, 0x41;      

   jl next_indx;

   cmp cl, 0x7A;      

   jg next_indx;

   cmp cl, 'a';

   jl convert_down;

   jge convert_up;

convert_down:

   or cl, 0x20;        //make it lowercase

   jmp write;

convert_up:

   and cl, 0x20;      

   jmp write;

write:

   mov byte ptr [eax + ebx], cl    

next_indx:

   inc edi;

exit:

   cmp edi, array_size;

   jl readArray;

mov char_array, eax;

}

}

Explanation:

  • Move char_array to eax as it is base image .
  • Use ebx as offset .
  • Use ecx as the storage register .
  • check if cl is <= than ASCII value 65 (A) .
6 0
3 years ago
PLEASE HELP ASAP!!
inn [45]
The answer is encryption

steganography would be hiding data, like in an image
digital forensics is the analysis done after an attack
and the last one is a security standard
6 0
2 years ago
Create a program in Matlab that prints the numbers from 1-100.
Burka [1]

Answer:

numbers = 1:1:100;

for num=numbers

remainder3 = rem(num,3);

remainder5 = rem(num,5);

 

if remainder3==0

disp("Yee")

else

if remainder3 == 0 && remainder5 == 0

disp ("Yee-Haw")

else

if remainder5==0

disp("Haw")

else

disp("Not a multiple of 5 or 4")

end

end

end  

end

Explanation:

  • Initialize the numbers variable from 1 to 100.
  • Loop through the all the numbers and find their remainders.
  • Check if a number is multiple of 5, 3 or both and display the message accordingly.
4 0
3 years ago
Use the single-server drive-up bank teller operation referred to in Problems 1 and 2 to determine the following operating charac
elena-s [515]

Answer:

This question is incomplete, here's the complete question:

1. Willow Brook National Bank operates a drive-up teller window that allows customers to complete bank transactions without getting out of their cars. On weekday mornings, arrivals to the drive-up teller window occur at random, with an arrival rate of 24 customers per hour or 0.4 customers per minute. 3. Use the single-server drive-up bank teller operation referred to in Problems 1 to determine the following operating characteristics for the system: a.) The probability that no customers are in the system. b.) The average number of customers waiting. c.) The average number of customers in the system. d.) The average time a customer spends waiting. e.) The average time a customer spends in the system. f.) The probability that arriving customers will have to wait for service.

Explanation:

Arrival rate \lambda = 24 customers per hour or 0.4 customers per minute

Service rate \mu​ = 36 customers per hour or 0.6 customers per minute (from problem 1)

a.) The probability that no customers are in the system , P0 = 1 - \lambda / \mu

= 1 - (24/36) = 1/3 = 0.3333

b.) The average number of customers waiting

Lq = \lambda^2 / [\mu(\mu - \lambda)] = 242 / [36 * (36 - 24)] = 1.33

c.) The average number of customers in the system.

L = Lq + \lambda / \mu = 1.33 + (24/36) = 2

d.) The average time a customer spends waiting.

Wq = \lambda / [\mu(\mu - \lambda)] = 24 / [36 * (36 - 24)] = 0.0555 hr = 3.33 min

e.) The average time a customer spends in the system

W = Wq + 1/\mu = 0.0555 + (1/36) = 0.0833 hr = 5 min

f.) The probability that arriving customers will have to wait for service.

= 1 - P0 = 1 - 0.3333 = 0.6667

3 0
2 years ago
Other questions:
  • "Different links can transmit data at different rates, with the _______ of a link measured in bits/second"
    11·1 answer
  • Mobile computing has two major characteristics that differentiate it from other forms of computing. What are these two character
    8·1 answer
  • List two items that are required to make a text file into a bash script.
    15·1 answer
  • science and technology are interdependent advances in one lead to advances in the other. give an example of this phenomenon.
    5·1 answer
  • Only technical managers needs to know about programming, web view source code and about technology issues.
    12·1 answer
  • Plz subscribe my yt gaming channel <br>FIREAZZ GAMING​
    8·2 answers
  • I am not a living being, I am a cylindrical shape that has three to eight sides. I never die. I can build anything again. What i
    5·1 answer
  • What are your undertale + au ships?
    15·1 answer
  • Select the correct answer.
    5·2 answers
  • Which type of attack can be addressed using a switched ethernet gateway and software on every host on your network that makes su
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!