Be careful: the result of a multiplication by 1000000 could easily exceed the limit of a "long" (signed long: 2,147,483,647; unsigned long: 4,294,967,295). If it does, then you will get garbage.
If I were you, I would implement long division.
If you were me, you'd have to forget what I know about maths first, maths I learned without handheld electronic calculators that only started to get under-$100-cheap during my last year of HS.
You'd have to forget all the business and production code I wrote back before PC's had FPU's. That's over 10 years of getting it right to the penny or other mark for over 10 years.
I can multiply 1 million times 2000 and not overflow a long, so in this case I decided to show 6 places where 3 or 4 would do.
If I wanted to go higher, I'd cast my data as 64-bit long long and do my multiplies and divides there.
In fact with Forth that is how the scaling operator, */, works except it does 16 to 32 bit.
Yeah, you do have to take care that your possible results of any step do not exceed your variables.
Last time I checked, string.h functions required me to keep my strings inside my array bounds too.