public static isDivisibleByFive(int input)
{
String str_input = String.valueof(input); // convert initial int to string.
if ((str_input.charat(str_input.length()-1) == '5') ||
(str_input.charat(str_input.length()-1) == '0') // check if the last
character is 0 or 5
.... return true;
return false;
}

u can try something like this ...
On Tue, May 3, 2011 at 9:25 AM, Dave <dave_and_da...@juno.com> wrote:

> Given an integer n, give an O(log n) algorithm to determine if n is
> divisible by 5 without using division or mod.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Umer

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to