I need to express some numbers (for example, 1300, 500, 900) as a percentage where the total would be 1 not 100.
There could 10 numbers and the could be in the range of 1 to 99,999, I guess.
I need to do some maths in my program to convert these numbers into the appropriate values.
I’m probably not explaining this well.
Don’t worry about the code, but heres what I need.
[chart addSlicePortion:0.1 withName:@"Orange"];
[chart addSlicePortion:0.2 withName:@"Fandango"];
[chart addSlicePortion:0.1 withName:@"Blue"];
[chart addSlicePortion:0.1 withName:@"Cerulean"];
[chart addSlicePortion:0.3 withName:@"Green"];
[chart addSlicePortion:0.1 withName:@"Yellow"];
[chart addSlicePortion:0.1 withName:@"Pink"];
I need to produce the number 0.1, 0.2 etc. Notice that they add up to 1
Divide each of the numbers by the total sum of all of the numbers. So,
Note that the sum of these numbers is
You can also check this by adding the decimal expansions given.