Hackety Hacking Problem Family Tree FibonacciSeries

From OLPC
Revision as of 09:42, 11 October 2007 by 221.134.239.130 (talk) (New page: ==Problem Statement== Write a program to print the fibonacci series till 'n' no terms. Fibonacci Series :- It is the series which starts with 0 & 1 and after that every no is the sum of ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Problem Statement

Write a program to print the fibonacci series till 'n' no terms.

Fibonacci Series :- It is the series which starts with 0 & 1 and after that every no is the sum of previous two numbers in the series.In mathematical form we can say

F1=0 F2=1

for n>2

Fn=Fn-1 + Fn-2

Sample Output

Enter the no of terms to be printed : 10
The Fibonacci Series is :

0 ,1 ,1 ,2 ,3 ,5 ,8 ,13 ,21 ,34

Curriculum Connection

To solve this problem students will

  • Take input from user
  • Will first check the nature of problem
  • Simulates the mathematical function using loops
  • Simulation will require nesting of loops
  • Print the output

Soltion in RUBY

Will be given soon.......