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
Nookie1986 [14]
3 years ago
13

Problem statement: Using loop, write a program that will ask the user to enter a character for left or right. Then, the user wil

l enter a number. The program should generate a ladder of X wherein the level depends on the number entered and the character should dictate whether it faces right or left.
Sample:

Character is r
Number is 3

Output
X
XX
XXX

Character is r
Number is 6
X
XX
XXX
XXXX
XXXXX
XXXXXX

Character is l
Number is 5

X
XX
XXX
XXXX
XXXXX
Computers and Technology
1 answer:
zvonat [6]3 years ago
7 0
Define variables
left is l
right is r

Ask input
left or right

Ask input value

Equate l or r to the input value

Show ladder with steps equal to input value and in the side of input variable
You might be interested in
PLS HURRY!!<br> Look at the image below
Crank

The output will be 10.

The while loop runs until numb is equal to or less than 13.

25 - 5 = 20

20 - 5 = 15

15 - 5 = 10, which is less than 13 so the loop stops and 10 is printed to the screen.  

4 0
3 years ago
github Portfolio Balances An investor opens a new account and wants to invest in a number of assets. Each asset begins with a ba
OLEGan [10]

The following code will be used to determine the maximum amount invested

<u>Explanation:</u>

long maxValue(int n, int rounds_rows, int rounds_columns, int into rounds)

{

   // Define the variable to store

   // the maximum amount invested.

   long max = 0;

   

   // Define an array of size n,

   // to store the n investments.

   long *investments = (long*)malloc(sizeof(long)*n);

   int i=0;  

   // Initially set all

   // the investments to 0.

   for(i=0;i<n;i++)

   {

       investments[i] = 0;

   }

   i=0;

   // Run the loop to

   // perform the rounds.

   while(i<rounds_rows)

   {

       // Get the left value

       // of the current round.

       int left = rounds[i][0];

       

       // Get the right value

       // of the current round.

       int right = rounds[i][1];

       // Get the contribution

       // for the current round.

       int contribution = rounds[i][2];

       // Since the user uses 1-based

       // indexing, subtract 1 from left

       // and right as the program uses

       // 0-based indexing. That is, the

       // investments in the array start

       // from 0 and not 1.

       right = right - 1;

       int j=0;

       // Run the loop to add the

       // contribution to all the investments

       // between left and right, both inclusive.

       for(j=left; j<=right; j++)

       {

           investments[j] += contribution;

       }

       i++;

   }

   // Traverse the investments array

   // to find the maximum element.

   max = investments[0];

   for(i=1; i<n;i++)

   {

       if(investments[i]>max)

       {

           max = investments[i];

       }

   }

   // Return the

   // maximum investment.

   return max;  

}

6 0
3 years ago
What are the main advantages of a solid-state drive (SSD) over a conventional hard disk drive (HDD)? (Choose three)
Masja [62]

Answer:

The benefits of SSDs over HDDs include:

Faster read/write speeds. SSDs can access large files quickly.

Quicker boot times and better performance. Because the drive does not need to spin up as an HDD would, it is more responsive and provides better load performance.

Durability. ...

Power consumption. ...

Quieter. ...

Size.

Explanation:

4 0
2 years ago
Gourmet pizza shop with a
Alja [10]

Answer:

B.Strong direct competition.

Explanation:

Netflix can be viewed by anyone and at anytime.

8 0
2 years ago
With fan fiction, readers:
Wewaii [24]
I would say C) play with words, images, and assiciations.
~Silver
8 0
3 years ago
Read 2 more answers
Other questions:
  • Shut down and unplug the computer. Remove the CPU case lid. Locate the various fans, and then use
    11·1 answer
  • Betty took her friends bowling. they rented 4 lane. 10 people need rent shoes and
    12·1 answer
  • 1. Create an anonymous block that will count the number of students whose gr_t1 grade is higher than the average on gr_t1 and di
    13·1 answer
  • Survey data are collected by using all of these methods EXCEPT
    12·1 answer
  • Controlling access of information on the internet
    15·1 answer
  • Label provides the code that executes if no case label is matched ​
    6·1 answer
  • When measuring processor speed,a megahertz is much faster than a gigahertz.true or fals
    12·1 answer
  • The BaseballPlayer class stores the number of hits and the number of at-bats a player has. You will complete this class by writi
    13·1 answer
  • Write a program (main method) that advises the user on programming language. So if a user for instance enters "Java" the program
    6·1 answer
  • Software that converts program written in other language into machine language​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!