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 rental car company charges $150.00 for a weekly rental and an additional $0.20 for each mile driven. The function rule C = 0.20m+ 150.00 describes the relatio
In what year did consumers get the best deal on a mortgage?
John played a note on his tuba that vibrated the air 120 times per second. If you play the note for 4 seconds, how many times in the air vibrate?
what issue do you think arose for workers
Revise this sentence by changing all of the infinitives to gerunds. "To run competitively means to learn everything about yourself while having the time of your
I need help with 12 only
What is the purpose of juvenile courts in the United States.
Ann read fewer books than Susan. Linda read more books than Ann,but fewer than Tammy. In which order do they go.
Recording relative positions should reduce total programming time true or false
16(4-2) power of 3 +3÷(10-7)