Count and Sum
The fourth statement of this program increases the value of variable b by 6.
Here are four different ways to increase the value of a variable by 1.
There are other ways to modify the value of a variable.
The text after the symbols '<<' is called a comment. Comments are ignored by the computer.
This program prints out the first 10 odd numbers.
This program calculates the sum of the first 10 natural numbers.
What is the sum of the first 100 natural numbers?
This program calculates the sum of squares of the first 9 natural numbers.
This program calculates the sum of 9 random numbers.
This program rolls the dice 15 times and counts how many times it got a 6.
Modify the program so that it rolls two dice 15 times. It should count how many times it got doubles.
... #num dice1 = rn(6); #num dice2 = rn(6); println "Dice roll: ", dice1.str," ",dice2.str; if dice1=dice2 ...