Master Mathematics.

Programming · Python, C & Pseudocode · Problem 6

A recursive multiplication

Consider the Python code

def f(a,b):
    if (a==0):
        return b
    if (a%2==1):
        return 2*f((a-1)/2,b)
    return b+f(a-1,b)
print(f(15,10))

The value printed is .

Source: GATE DA