Calculate Whole from Fraction

32 Views Asked by At

The goal is to calculate the total of a statistic which has only percentages but no absolute numbers. It is known that the values of total and all percentages are integers.

I want to find all values behind the percentages, which are whole numbers (integer) this should be possible with the rule of three.

I dont come from maths so sorry for the incorrect notation of the equaiton. I do mostly code, but i thought I'd better ask before I code something stupid.

The goal is a function which loops thru all values of n. if the function of total is an integer, then this is a possible value for n.

p     (percentage)     = 5.2
n     (possible value) =  13 (and multiples of 13)
total (unknown)        = 250 

Am I on the right path or completely wrong? Your help is highly appreciated, wether it is a hint or a complete new approach. Best endo