# Two whole numbers n and k . Print k decimal digits of 1 / n .

I have to print these decimal numbers in C++ . But first i need to understand this question mathematically .

• If $k=9,n=387$ then the output should be $.002583979$ or $(0,0,2,5,8,3,9,7,9 )$. – lulu Oct 2 '18 at 16:38

I suppose $k$ could be arbitrary so we cannot rely on just computing $1/n$ within C++ code and extracting $i$-th decimal by multiplying with $10^i$ and taking $mod\ 10$.
We cannot do this for large $k$ because computer can store just a fixed amount of decimals (if some additional libraries are not used).
The simplest solution would be to just implement long division and print the decimal after each of $k$ steps.