Lets solve some real problems
Project euler: 1
result = 0 (Remember 0 as result)
max = 10
index = 1
until index < max
if index % 3 == 0 or index % 5 == 0 then
result = result + index
endif
index = index + 1
say result
Project euler 2
- problem
- Let me create a fibbonaci sequence
sum = 2
a = 1
b = 2
until a + b < 100
c = a + b
if c%2 == 0 then
sum = sum + c
endif
a = b
b = c
say sum
To solve Fibonacci sequence is generated by adding the previous two terms.By considering the terms in the Fibonacci sequence whose values do not exceed 50
i have written the following psuedo code (my own language ), help in executing this
sum = 2
a = 1
b = 2
until a + b < 50
c = a + b
if c%2 == 0 then
sum = sum + c
endif
a = b
b = c
say sum
Solve this
- Find if the number is prime or not
- Find factors of 100