Untitled

mail@pastecode.io avatar
unknown
python
3 years ago
483 B
1
Indexable
Never
def triangle(a, b):
    lVar1 = lVar2 = 0

    if a < b:
        lVar1 = 0
    else:
        if (a == 1) and (b == 1):
            lVar1 = 1
        else:
            if b == 1:
                lVar1 = triangle(a - 1, a - 1)
            else:
                lVar2 = triangle(a, b - 1)
                lVar1 = triangle(a - 1, b - 1)
                lVar1 = lVar1 + lVar2
    return lVar1


x = int(input("Enter the first number:"))
for y in range(1, x + 1):
    print(triangle(x, y))