Open In App

Puzzle | Know Average Salary without Disclosing Salaries

Last Updated : 22 Aug, 2025
Comments
Improve
Suggest changes
282 Likes
Like
Report

Three Employees want to know the average of their salaries. They are not allowed to share their individual salaries.

salary3


Check if you were right - full answer with solution below.

Solution :

Follow the steps below

Step 1: X adds a Random Number and his salary and tells the sum to Y.

Step 2: Y also adds a Random Number and his salary to the sum told by X and tells new sum to Z.

Step 3: Z also adds a Random Number and his salary to the sum told by Y and tells new sum to X.

Step 4: X subtracts its random number from the sum told by Z and tells the new number to Y.

Step 5: Y subtracts its random number from the sum told by X and tells the new number to Z.

Step 6: Z subtracts its random number from the sum told by Y and announces the new number. The new number is now the sum of three salaries and the average can be calculated by dividing the sum by 3. Finally, nobody knows the salary of others, but all know average.

This can be extended to more than 3 employees also.


Explore