[Solved] Javascript – loops [closed]
Suppose there are n people attending this quiz, the # of the winner is x. So the sum of people entering before the winner is the sum of 1+…+(x-1), the sum of people entering after the winner is the sum of (x+1)+…+n. Here we have 1+…+(x-1) = (x+1)+…+n, which derives to (x*(x-1))/2 = ((x+n+1)*(n-x))/2. Simplifying … Read more