If I had $1000(variable) and I want to split that amount up and give it to 20(variable) people, but rather than give it evenly to each person, I want to give more to the 1st per
Formula is correct, needed a little touch.
When going within the for go from the first person to the n-1
int people = 20;
float prize = 1000;
float k = (2 * prize) / ((people) * (people - 1));
float sum = 0;
for (int i = 1; i < people; ++i)
{
var personsPrize = i * k;
sum += personsPrize;
Console.WriteLine(personsPrize);
}
Console.WriteLine("sum = " + sum);