How can i get period from periodic number? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can i get period from periodic number?

I need to get period from periodic number. Ex. from 1.1313131 etc. get just 13. Any help, even just pseudocode will be appreciated.

30th Jan 2019, 8:47 AM
Maneren
Maneren - avatar
2 Answers
+ 1
Thanks, but i got that too, i just don't know how am i supposed to do that, to get 78 from 0.234787878... etc.?
31st Jan 2019, 11:33 PM
Maneren
Maneren - avatar
+ 1
Make the %10 of the number to remain only with 0.131313..., then make the same thing with 0.131313... so you can store the first value if 13 and compare with second to see if it is the actual period. If it is, then you have it in a variable and can you use it.
31st Jan 2019, 7:05 PM
Charlie S
Charlie S - avatar