Course of Raku / Addendum 🆕 / Flow and functions / Control flow and logic / Exercises

Sum until over a hundred

Problem

Add the whole numbers 1, 2, 3, … one at a time until the running total first passes 100. Print the total reached and how many numbers were added.

Example

The program prints:

reached 105 after adding 1..14

Solution

See the solution

Course navigation

Solution: Rock, paper, scissors   |   Solution: Sum until over a hundred