Elabore un diagrama de flujo que imprima los n primeros números de la serie Fibonacci.
1 1 2 3 5 8 13 21 34 55 89
Solución:
print("SERIE FIBONACCI\n")
num=int(input("Ingrese Serie Para Numero : "))
while num>0:
f1=1
f2=1
print("1")
for i in range(num):
print(f2)
f2 =f1+f2
f1=f2-f1
num=int(input("Ingrese Serie Para Numero : "))
Resultado por pantalla:
SERIE FIBONACCI
Ingrese Serie Para Numero : 10
1
1
2
3
5
8
13
21
34
55
89
Ingrese Serie Para Numero :
No hay comentarios.:
Publicar un comentario