Express fraction( _N, _D )
as a percent.
When the denominator is 100, you can simply take the numerator and apply the % sign:
fraction( _N, _D )
= 100 * DEC%
fraction( _N, _D )
reduces to fraction( N, D )
.
To turn a fraction into a percent, turn the fraction into a decimal and then multiply the decimal by 100.
Denominators of 10 are an easy case: The decimal form is just the numerator with the decimal place moved left by the number of 0s in the denominator - in this case 1 place.
To turn fraction( N, D )
into a decimal, perform long division, dividing D
into N
(if you need help with this, try practicing some Division exercises or watching some related videos).
N \div D = DEC
To convert this decimal into a percent, we need to multiply it by 100.
DEC = (100 \cdot DEC) \% = roundTo( 2, 100 * DEC )\%