There is a famous legend of a student misbehaving in class back in the late 1700s. For punishment, the teacher made
him add up all of the number between 1 and 100. To the teacher's surprise, the student did it in seconds. The student
was the (now) famous mathematician Carl Gauss. For loops can easily add up sequences of numbers. Let's
repeat Gauss's punishment here with a for loop. Gauss's famous formula for adding numbers from $1$ to some number $a_n$ is $S_n=n(1+a_n)/2$.
This formula might be in your math book.

`sum`

to add up the numbers between 1 and 100.
Type your code here:

See your results here:

The code will not run as is! You have to look carefully at the

`for i=, do`

line and fix it
to cause the variable `i`

to run between 1 and 100. Can you do it?
Dismiss.
Does your code work? Want to run it on your iPhone?

Here's your code:

- Use [Control]-[C] (Windows) or [⌘]-[C] (MacOS) to copy your code.
- Paste it using [Control]-[V] (Windows) or [⌘]-[V] (MacOS) into
this page
- Then click the "Use on iPhone" button that you'll see.