Unit 2 Task 18: Charity jar total

Learn to code with step-by-step lessons. A place for students to work through programming fundamentals and build skills.

Unit 2 Task 18 - Charity jar total

← Unit 2 tasks · Solution


People drop donations into a jar. You type each amount (float). When the day ends, enter 0 to stop (0 is not a donation).

Print the total raised.

Skills: sentinel loop, same idea as Task 1 but framed as charity-students can reuse structure.