Scripting Classroomnotes 24/Nov/2022

Problem – Fibbonaci numbers

  • 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. Find the sum of all the even fibonnaci numbers below 100
  • Recipe
ingredients:
1, 2 (starting numbers) list

2 (even number)

steps:
1. add last two numbers of list  write the result and add it to list if result < 100 otherwise go to step 4
2. check if the result is even (if it ends with 0,2,4,6,8) and add to sum
3. go to step 1 and exit if the result is greater than 100
4. print sum

Problem: Factors

  • Sample:
100 => 2,4,5,10,20,25,50

39 => 3, 13
  • Recipe
ingredient:
number 

steps:
1. start from index 2 till number/2 (number-1)
2. check if number is divisibe by index and if yes write down the index

Leave a Reply

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

About continuous learner

devops & cloud enthusiastic learner