SCHOOL OF CODE BUILDERS
Learn To CODE. Become A DEVELOPER.
Pages
HOME
DATA STRUCTURES
STRINGS
ARRAYS
MATRIX
BINARY TREES
LINKED LIST
STACK
QUEUE
SORTING
SEARCHING
C
PYTHON
PSEUDOCODE
CONTEST PROBLEMS
ALGORITHMS
PATTERNS
PHP
C PUZZLES
C INTERVIEW QUESTIONS
JAVA
C++
HASHING
RECURSION
BASIC C PROGRAMS
TCS-CODEVITA
FACEBOOK
CONTACT US
To Print N Fibonacci Numbers
To Print N Fibonacci Numbers
PrintNFibonacci (): Read an Integer N ''' To create the first number "0" of the fibonacci numbers, setting the previous two numbers as "-1" & "1", sum of which gives, "0" as first number ''' Set Previous = -1 Set Current = 1 Set i = 1 Do Until i <= N : ''' Every number of the Fibonacci Series is formed by the sum of the previous two numbers ''' Next = Previous + Current # Print the current value, the Fibonacci Number Print Next ''' Update the previous & current value, so that the next Fibonacci number may be valuated from sum of previous + current ''' Previous = Current Current = Next i = i + 1 End Loop
PREVIOUS
NEXT
HOME