looping
Sample – 1
- Sum of all numbers from 1 to 10
result = 0
start = 1
end = 10
until start <= end
result = result + start
start = start + 1
say result
Sample – 2
number = 5
result = 1
start = 1
until start <= number:
result = result * start
start = start + 1
say result
Sample – 3
start = 1
end = 10
result = 0
until start < 10
if start % 3 == 0 or start % 5 == 0
result = result + start
start = start + 1
say result
Sample – 4
a = 1
b = 2
result = 2
until a + b < 100
c = a + b
if c % 2 == 0
result = result + c
a = b
b = c
say result
Exercise
- Find if the number is prime or not