One solution that is very simple is: while doing division keep storing the dividend. if any one dividend is repeated stop there and extract the part between first occurrence digit before new occurrence. Example:
7/9 7) 9 (1.*285714*28 7 -- 20 14 --- 60 56 --- 40 35 --- 50 49 --- 10 7 ---- 30 28 ---- 20 14 ---- 60 56 repeats here *285714 is repeating pattern. * On 10 June 2010 08:55, Veer Sharma <thisisv...@rediffmail.com> wrote: > Seems it wont work... > x=23.34563456 > > temp = x*100 -x = 233.4563456 - 23.34563456 = 210.11071104 > temp = x*100 -x = 2334.563456 - 23.34563456 = 2311.21782144 > temp = x*1000 -x = 23345.63456 - 23.34563456 = 23322.28892544 > temp = x*10000 -x = 233456.3456 - 23.34563456 = 233432.99996544 > temp = x*100000 -x = 2334563.456 - 23.34563456 = 2334540.11036544 > > ... > > On Jun 9, 11:24 pm, Anurag Sharma <anuragvic...@gmail.com> wrote: > > multiply the original number x=23.34563456 > > > > Anurag Sharma > > > > On Wed, Jun 9, 2010 at 10:36 PM, Veer Sharma <thisisv...@rediffmail.com > >wrote: > > > > > > > > > One question: > > > > > No x = 23.34563456 > > > temp = x X 10 = 233.4563456 > > > temp = temp - x = 210.11071104 > > > decimal part zero? No. > > > Now multiply the no. with 100. Which no? original x (= 23.34563456) or > > > new no. temp (=210.11071104)? > > > > > On Jun 9, 8:12 pm, divya jain <sweetdivya....@gmail.com> wrote: > > > > multiply the no. with 10 nd store in temp. now subtract no from temp. > > > check > > > > if the decimal part is zero if yes. then 1st digit after decimal is > > > > recurring. if no. multiply the no with 100 and repeat . if this time > > > decimal > > > > part is zero then 2 digits after decimal r recurring nd so on.. > > > > > > On 8 June 2010 21:45, Veer Sharma <thisisv...@rediffmail.com> wrote: > > > > > > > You have a Numerator and Denominator. After division you might get > a > > > > > recurring decimal points float as the answer. > > > > > > > Problem is: You need to identify the recurring part for a given > > > > > decimal no? > > > > > For example 23.34563456 ... > > > > > return 3456 > > > > > > > -- > > > > > You received this message because you are subscribed to the Google > > > Groups > > > > > "Algorithm Geeks" group. > > > > > To post to this group, send email to algoge...@googlegroups.com. > > > > > To unsubscribe from this group, send email to > > > > > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> > <algogeeks%2bunsubscr...@googlegroups.com> > > > <algogeeks%2bunsubscr...@googlegroups.com> > > > > > . > > > > > For more options, visit this group at > > > > >http://groups.google.com/group/algogeeks?hl=en.-Hide quoted text - > > > > > > - Show quoted text - > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "Algorithm Geeks" group. > > > To post to this group, send email to algoge...@googlegroups.com. > > > To unsubscribe from this group, send email to > > > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> > <algogeeks%2bunsubscr...@googlegroups.com> > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/algogeeks?hl=en.- Hide quoted text - > > > > - Show quoted text - > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algoge...@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- Thanks & Regards, Ravi.Thati -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@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.