anshu sols is best @venkat what if b=1000 On Thu, May 5, 2011 at 7:12 AM, venkatesan B <[email protected]>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 <[email protected]> > *To:* [email protected] > *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 <[email protected]> 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 [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. > > > > > -- > Umer > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > 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. > > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > 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. > -- 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 [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.
