Project Euler #2: Even Fibonacci numbers

  • + 0 comments
    #python
    t = int(input().strip())
    for a0 in range(t):
        n = int(input().strip())
        a=0
        b=1
        s0=0
        while a+b<=n:
            s=a+b
            if s %2==0:
                s0=s0+s
            a=b
            b=s
        print(s0)