0
Construct a function, that is, an algorithm that receive the maximum number of the sequence of Fibonacci.
Returning all numbers from zero to zero Fibonacci number less than or equal to the number informed. Example:
Function - fibonacci(10)
Will return - 0,1,1,2,3,5,8
print (" Trabalho de Fibonacci ")
n =int( input(" Digite Quantos termos você deseja :"))
t1 = 0
t2 = 1
print("{} . {} .".format(t1,t2), end="")
cont = 6
while cont <= n:
t3 = t1 + t2
print (" {}.".format(t3),end="")
t1 = t2
t2 = t3
cont +=1
print( " Fim ")
The code gives an error, I tried to change the cont for 3 but it didn’t work.
If you want to calculate the Fibonacci number less than or equal to the number reported, what this
contare you doing? Is he really necessary?– AlexCiuffa