Python to C
Please Log In for full access to the web site.
Note that this link will take you to an external site (https://shimmer.mit.edu) to authenticate, and then you will be redirected back to this page.
Consider this mystery function below that is written in Python. Rewrite it in C.
//takes in two integers num and base
def f_2(num, base):
total = 0
negative = num<0
num = abs(num)
while num>0:
val = num%base
total = base*total + val
num = int((num-val)/base)
if negative:
return -total
else:
return total