n = int(input("Enter no. of terms in Fibonacci Series : "))
fTerm = 0
nTerm = 1
print("\n")
for i in range(n):
if i<2:
print(i,end=",")
else:
temp = nTerm
nTerm = fTerm + nTerm
print(nTerm,end=",")
fTerm = temp
input("\n\nPress Enter to Exit.")
If you have a great ability of thinking, imagination and visualisation than you have to codes your thinking and visualisation.
Tuesday, 29 May 2018
To print ‘n terms of Fibonacci series using iteration using python programming.
Subscribe to:
Post Comments (Atom)
Featured post
To add 'ing' at the end of a given string (length should be at least 3). If the given string already ends with 'ing' then add 'ly' instead. If the string length of the given string is less than 3, leave it unchanged. <br/>Sample String : 'abc' <br/> Expected Result : 'abcing' <br/> Sample String : 'string'
#To add 'ing' at the end of a given string (length should be at least 3). If the #given string already ends with 'ing' then...
Popular Posts
-
#To add 'ing' at the end of a given string (length should be at least 3). If the #given string already ends with 'ing'...
-
# Write a program that accepts a comma separated sequence of words as input # and prints the words in a comma-separated sequence after...
-
# To implement Queue using list queueList = [] def enQueue(ele='\0'): if ele!='\0': queueList.append(...
No comments:
Post a Comment