Add up 1 to 100
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version.
Add up 1 to 100
Add every whole number from 1 to 100 and print the result.
This is a running total: start at 0 and add the loop variable on every pass. The starter adds 1 to 10, so you only need to change where the range stops. The young Carl Friedrich Gauss is said to have found this answer in his head by pairing 1 + 100, 2 + 99 and so on.
Use a for loop to add up every whole number from 1 to 100, then print the total once.
Click Run to see the output here.