williamsstacy5664 williamsstacy5664
  • 23-10-2017
  • Chemistry
contestada

Write a loop that subtracts 1 from each element in lowerscores. if the element was already 0 or negative, assign 0 to the element.

Respuesta :

Kalahira
Kalahira Kalahira
  • 01-11-2017
(pseudo-code)
 
var element = input
   
if element = or < than 0;
 
assign 0 to element;
 
else subtract 1 from element;
 
repeat
   
This problem will be seen in many introductory programming classes. The task assigned is to create a program that constantly subtracts 1 from a variable until the variable reaches 0, which then causes the variable to stay at 0. If said variable started out negative or 0, it will also stay at 0.
Answer Link

Otras preguntas

A chunk of paraffin (wax) has a mass of 50.4 grams and a volume of 57.9 cm3. What is the density of paraffin?
What widespread problem does Ishmael Beah attempt to reveal in his memoir A Long Way Gone? A. the life of refugees who fled Sierra Leone during the civil war B.
Rename the number 805 tens?
The best thing you can do to keep a positive relationship with your supervisor is a. keep your opinions to yourself. b. socialize with your supervisor and cow
What factors in texas caused it to become a desired location for the european explorers
Who is the famous painter right now?
Which of the following signs may indicate heat exhaustion a. muscle cramps, fatigue, and lightheadedness b. Hunger, fatigue, and back pain c. Lethargy, thirs
What is the value of the digit 8 in 686,293
The federal government __________ is an example of establishing justice.
Rename the number 805 tens?