Given the integers 1 ≤ a ≤ b, print all the fibonacci numbers between a and b, inclusive.


  • 0
    S
    def fibo_print(a, b):
        i, j = 0, 1
        while j < a:
            i, j = j, i+j
        while j <= b:
            print j
            i, j = j, i+j

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.