# How can four employees calculate the average of their salaries without knowing other’s salary

This solution has a limitation that information is partially passed  and there needs some trust level.

Salary of A: i

Salary of B: j

Salary of C: k

Salary of D: l

A passes to B (i + a) where a is a number that A knows B takes this a passes to C (i + j + a + b). C takes this and passes to D (i + j + k + a + b + c). D takes this and passes to A (i + j + k + l + a + b + c + d)

Now one after another they remove their constants.
Ex: A now passes to B: i + j + k + l + b + c + d (He has removed a)

B passes to C after removing of his constant (b).

Thus Finally D gets x + y + z + u + d. He takes away his constant and now he has i + j + k + l.

So the average is:(i + j + k + l) / 4.

Let us know if you know any other solution.

### 2 Thoughts on “How can four employees calculate the average of their salaries without knowing other’s salary”

1. Hitesh Kansal on August 27, 2013 at 5:45 am said:

why do they add constants? they simply can pass their saleries.

2. Anuj Modi on November 16, 2014 at 9:31 pm said:

Instead of each one passing a constant, only A can pass his salary + constant. Finally when D passes back the total + constant to A again, then A can deduct the constant from the total and compute the average.