Q. Write a program that passes value to a function mersenne() and the function return nth mersenne number.


Answer = 


def mersenne(x):
return 2**x-1

num = int(input ("Enter the number :- "))
print (mersenne(num))

Output :-

Enter the number :- 2
3

>>> 

Enter the number :- 6
63

>>>

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post