Site icon Matistics

Python – program to display the FIBONACCI Sequence for n terms where the value of ‘n’ is defined by the user

<code data-enlighter-language="python" class="EnlighterJSRAW">n = int(input("Enter the number of terms of fibonacci series: "))
temp = 0
fterm = 0
sterm = 1
i=0
print(fterm)
for i in range (0,n-1):
        temp = sterm
        sterm = fterm + sterm
        fterm = temp
        print(sterm)
Exit mobile version