@SAMMM have a look * *solution is to keep dividing the number by 3, i.e, do n = n/3 iteratively. In any iteration, if n%3 becomes non-zero and n is not 1 then n is not a power of 3, otherwise n is a power of 3
check it out ? http://codepad.org/863ptoBE Thanks Shashank Computer Science BIT Mesra http://www.facebook.com/wgpshashank http://shashank7s.blogspot.com/ -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/jhoet1Yl3F0J. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
