Help me for repeating decimal numbers plz

This is a discussion on Help me for repeating decimal numbers plz within the C Programming forums, part of the General Programming Boards category; hi all,how can I repeat decimal numbers to print out? for example: 1/6=0.1666.. repeating cycle is 6 and cycle length ...

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    21

    Help me for repeating decimal numbers plz

    hi all,how can I repeat decimal numbers to print out?
    for example:
    1/6=0.1666.. repeating cycle is 6 and cycle length is 1
    5/7=0.71428571428571...repeating cycle is 714285 and cycle length is 6
    but
    1/250=0.00400..repeating cycle is 0 and cycle length is 1

    I hope anyone can help me out!Thanx in advance!!

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    21
    Well, it is a contest problem...
    oringinal problem set is here:

    http://isaac.lsu.edu/class/udv/v2/202.html

    Hope someone can help me, thanks!

  3. #3
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    I can think of solution just doing long decimal division, but this would
    be very slow.

  4. #4
    Registered User
    Join Date
    Sep 2001
    Posts
    21
    Originally posted by Nick
    I can think of solution just doing long decimal division, but this would
    be very slow.
    but how can i find the repeat decimals?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Faster way to divide numbers
    By scwizzo in forum C++ Programming
    Replies: 3
    Last Post: 04-29-2009, 12:45 PM
  2. Logical errors with seach function
    By Taka in forum C Programming
    Replies: 4
    Last Post: 09-18-2006, 06:20 AM
  3. hex to binary,hex to decimal
    By groovy in forum C Programming
    Replies: 2
    Last Post: 01-25-2006, 02:14 AM
  4. Confused by expression.
    By Hulag in forum C Programming
    Replies: 3
    Last Post: 04-07-2005, 08:52 AM
  5. decimal to binary, decimal to hexadecimal and vice versa
    By Unregistered in forum C++ Programming
    Replies: 9
    Last Post: 12-08-2001, 11:07 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21