I am programming in a language that does not support decimal numbers. The language only supports positive or negative whole numbers. Is there a way to calculate the percent of a number only using whole numbers?
The language automatically rounds the number down in the case of a remainder. I.e. 97 / 33 = 2
I have two values:
The percent and the number I am trying to get the percent of.
For example, lets say I have the number 126,345 and I want to get 13 % of that number.
The result of that normally would be 16,424.85. If this is possible the language would cut off the .85 remainder which is fine.
Thanks for your time and help!
As said by @magdiragdag in the comments, multiply by $13$ and then divide by $100$.
If your division rounds down (so that $160/100=1$) and you want to round to the nearest whole number instead, multiply by $13$, then add $50$, and then divide by $100$.