anshu sols is best
@venkat what if b=1000

On Thu, May 5, 2011 at 7:12 AM, venkatesan B
<venkat_b_engin...@yahoo.co.in>wrote:

> b=n*0.2;
> if((b-floor(b))==0)
> print " number is divisible by 5";
> else
> print " number is not divisible by 5";
> ------------------------------
> *From:* Umer Farooq <the.um...@gmail.com>
> *To:* algogeeks@googlegroups.com
> *Sent:* Tuesday, 3 May 2011 10:27 AM
> *Subject:* Re: [algogeeks] Divisibility by five
>
> 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.
>
>
>  --
> 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.
>



-- 
Regards
Aditya Kumar
B-tech 3rd year
Computer Science & Engg.
MNNIT, Allahabad.

-- 
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