etharendil
New member
- Joined
- Nov 24, 2013
- Messages
- 1
I'd like to split number e.g. 40 equally as much is possible between participants based on the level.
The result should be integer
John level 1
Ed level 4
Andre level 5
Eva level 6
what is
1+4+5+6=16
40/13=2,5
The result should be whole number so
John: 1x2,5 will have 2
Ed 4x2,5 will have 10
Andre 5x2,5 will have 12
Eva 6x2,5 will have 15
sum is 39 (1 left)
and that one which left should belong to Eva because she have highest level.
The number of the participants,base number(40) and the levels are various.
The base number might be e.g. 20 with 6 participants level 4 and one level 1.
This is kinda tricky for me and I'm not sure how to solve it. And I'd like to use it as function in program.
Do you have some idea how can I properly calculate this?
thank you very much
The result should be integer
John level 1
Ed level 4
Andre level 5
Eva level 6
what is
1+4+5+6=16
40/13=2,5
The result should be whole number so
John: 1x2,5 will have 2
Ed 4x2,5 will have 10
Andre 5x2,5 will have 12
Eva 6x2,5 will have 15
sum is 39 (1 left)
and that one which left should belong to Eva because she have highest level.
The number of the participants,base number(40) and the levels are various.
The base number might be e.g. 20 with 6 participants level 4 and one level 1.
This is kinda tricky for me and I'm not sure how to solve it. And I'd like to use it as function in program.
Do you have some idea how can I properly calculate this?
thank you very much
Last edited: