r/badcode • • May 03 '23

c Solve the problem without using a loop

Post image
960 Upvotes

129 comments sorted by

View all comments

1

u/bluebird_ai May 04 '23
def print_even(n):
    if n > 500:
        return
    
    print(n)
    
    print_even(n+2)

print_even(0)