Python Examples
Pages
List of Python Examples
Fundamentals of Python
Python Creation Python is a widely used high-...
Saturday 23 December 2017
Fibonacci Number using Python Code
Fibonacci Numbers Using Pythan
Definition :-
In mathematics,the
Fibonacci Number
are numbers in following integer sequence 3,5,8,13,21,34,55
Fn=Fn-1 +Fn-2
where seed Values F1=1 and F2=1
The first 11 Fibonacci numbers Fn for n=0,1,2,....,11 are
f0
f1
f2
f3
f4
f5
f6
f7
f8
f9
f10
f11
0
1
1
2
3
5
8
13
21
34
55
89
PYTHON CODES
When the series start with any two consecutive user define no's
num1=input( 'Enter first no ') num2=input( 'Enter second no ') Tno=input('NO of terms in Series') print num1 print num2 while(Tno-2): c=num1+num2 num1=num2 num2=c print c Tno=Tno-1
When the series start with 1 and user define Terms
num1=1 num2=1 Tno=input('NO of terms in Series') print num1 print num2 while(Tno-2): c=num1+num2 num1=num2 num2=c print c Tno=Tno-1
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
IT's Good
Check Number is Prime Using Python
Number is Prime Or Not First We want to Know Theory of Prime Number A prime number (or a prime ) is natural number greater...
(no title)
IT's Good
No comments:
Post a Comment