Five coworkers want to know what the average of all their salaries is, but refuse to reveal ANY information about their own salaries to their coworkers. How can they calculate the average?
Hints: What if one of the workers picks a random number that only he knows? How could this help?
*Let's call the workers: Worker 1, Worker 2, Worker 3, Worker 4 and Worker 5.
Worker 1 picks a random positive number N (which he doesn't tell anybody), add his salary to it, and writes this number on a piece of paper which he hands to Worker 2.
Worker 2 adds his salary to this number, writes the new number on a different piece of paper, and hands it to Worker 3.
Worker 3 does the same and hands a new paper to Worker 4, who does the same and hands a new paper to Worker 5, who does the same and hands a new-paper back to Worker 1.
The number written on this final piece of paper will be (N + the-sum-of-every body’s-salary).
So Worker 1 simply subtracts N from this number and divides this final number by 5, which is the average salary. At no point did any worker gain any information about anyone else's salary.