## Goal

• Becoming better in understanding the language which we need to speak with the program

### Problem: Power of Compounding

• First lets try to Solve Compound intrest
``````Take any amount which you can save every month
apply the Compount intrest formual for period of any years you wish and solve the problem

P * ( 1+R/100)^n

monthly savings = 10000 (10k)

yearly = 120000

save = 10 years

120000 * (1 + 10/100)^10

120000 *  1.1 ^ 10
120000 * 2.59  = 3,11,000
``````
• The above stuff is for our understanding, now we need to assign this work to the program in any language
``````What program is aware of   + - * / % pow (^)

Hi snake remember 120000 and i will call it by P
remember 10 as t (number of years)
remember 10 as r ( rate of intrest)
now calculate P * (1 + r/100)^t and display this as result
``````
• Our Power of Compounding is not finished yet, but till that point use the following link

### Problem 2: Project Eulers Problem 1

• Problem Statement: If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.

• Solving this on any Program
``````Snake is aware of  + - < > <= >= == / %

Hi Snake,
remember 3 and call it as  number1
remember 5 and call it as  number2
remember 10 and call it as  max
remember 1 and call it as index
remember 0 and call it as result
Important Step::
calculate index%3 and store it in result1
calculate index%5 and store it in result2
check if result1 is zero or if result2 is zero
if the above statement is true
remember index and add it to result
increment index and go to Important Step:: if index < max
display result

``````

### Problem 3: Project Eulers Problem 2

• Problem Statement: Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:

1, 2, 3, 5, 8, 13, 21, 34, 55, 89, …

By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.

``````Hi snake
remember 1 and call it as a
remember 2 and call it as b
remember 2 and call it as result
remember 0 and call it as c

Important Step::
calculate a+b and store in c
check if c%2 ==0 and if yes add c to result
assign value of b to a
assign value of c to b
Go to Important Step till C < 100
display result

``````

#### Exercise

This site uses Akismet to reduce spam. Learn how your comment data is processed. 