Write a program to find whether a number is Gandhi number or not.
Answers
Answered by
0
A simple method which I use is to take log of the given number on base 4, and if we get an integer then number is power of 4.
Another solution is to keep dividing the number by 4, i.e, do n = n/4 iteratively. In any iteration, if n%4 becomes non-zero and n is not 1 then n is not a power of 4, otherwise n is a power of 4.
Answered by
0
Explanation:
answer ✧༺♥༻✧✧༺♥༻✧✧༺♥༻✧✧༺♥༻✧✧༺♥༻✧
Attachments:
Similar questions