Learn to code with step-by-step lessons. A place for students to work through programming fundamentals and build skills.
A shop starts with S items. Repeatedly ask how many were sold this hour (integer). Subtract from stock.
Not enough stock and do not change stock.Shelf empty and stop.Print remaining stock whenever you like (e.g. after each valid sale).
Skills: while, guards on subtraction.