Fast Exponentiation using Bitmasking

When I am giving input 2 and 100 it is giving ans 0 .
But I have changed it to long long then also why ??

hello @ashwani225.

pls share ur code
btw 2^100 is a very big number we dont have any datatype that can store it. so may be becuase of overflow u r getting 0.

ur code is correct.
it is due to overflow u are getting zero for large value of a^n u are getting 0.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.