Here we are to create a python program to print the Fibonacci series upto N number?
WHAT IS FIBONACCI NUMBER?
Fibonacci numbers are used to create technical indicators using a mathematical sequence developed by the Italian mathematician, commonly referred to as “Fibonacci,” in the 13th century.
In mathematics, the Fibonacci numbers, commonly denoted Fₙ, form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 and 1.
All other terms are obtained by adding the preceding two terms. This means to say the nth term is the sum of (n-1)th and (n-2)th term.
PROGRAM & EXPLANATION
Firstly,get an integer input from the user and assign in to a variable(here,nterms).Now assign two new variables to 0 and 1 as it is the starting in the fibonacci series.
Now with help of conditional statements,check the user’s input.If the input is less than or equal to zero,return to the user saying to enter a positive integer.
If the user’s input is equal to 1,it will return as 0.
If the number of terms is more than 2, we use a while loop to find the next term in the sequence by adding the preceding two terms. We then interchange the variables (update it) and continue on with the process.It will stop once it reaches the nterms.
COMPLETE CODE:
Want to learn python from basics with IIT certification,try out https://www.guvi.in/courses-video?course=pythonEng&itm_source=courses_page&itm_medium=click
For more details login www.guvi.com