Click New Example to start working through an example. Click on instructions in the steps of the algorithm to see the values of the variables in each step. First click on step 1. and then on the following steps in the order of execution.
New Example Restart Example
Algorithm.Sum of the natural numbers up to n.
Input: A natural number n
Output: The sum of the natural numbers up to n
  1. let i := 0
  2. let s := 0
  3. repeat
    1. let i := i + 1
    2. let s := s+i
  4. until i = n
  5. return s