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

The polynomial 16x+2 is a
what events led to the outbreak of war
Use the distributive property to simplify (100+4z)20Show your work and show each step.
Which part of the excerpt supports the claim that Paine believed the human cost of the colonists' armed struggle against the British was well worth the outcome?
if the subtrahend is 9 and the difference is 8 what is the minuend
solve the perimeter of the plot that is 2(x-1) + 2(3x + 2)
how to sovle a One-Variable Equations
Anderson and his lab partner each held a tuning fork, 4440 Hz, in their hands. Anderson tapped his tuning fork with a mallet and they listened to the sound it m
Why do West Indians speak a variety of languages today?
Identify the factors of 13m-2n