I need to write a program that prints 0.(03) for input 1 and 33.
(1/33 = 0.03030303…. We use the notation 0.(03) to denote that 03 repeats indefinitely.)
As another example,
8639/70000 = 0.1234(142857)
I understand, I need to use an algorithm like floyds. But how do I get 0.0.030303030303 instead of 0.03030303030304 in java.
With this code, I think you’ll find what you’re looking for:
This yields the next result:
0.0303030303030303030303