A milkman has 100 cows number from 1 to 100. Every cow gives milk according to their numbers i.e i’th cow gives i litre milk. Milkman has 10 sons and he wants to divide his cows among his 10 sons so that every son should get an equal amount of milk, the task is to help him to know about the division of these cows among the sons.

**Solution:**

As we know that the i’th cow gives **i** litre milk. So first let us count the total litre of milk which is obtained from these cows. This can be solved by using arithmetic progression sum.

We know that sum of n numbers starting from 1 is always, sum = **n*(n+1)/2** .

So the total quantity of milk obtained if from 100 cows is total_milk = **100(100+1)/2=5050** litres.

As the problem says that the division of the cows should be done in a manner that every son get equal amount of milk. So every son should got 5050/10 = 505 litres of milk.

Now our main problem is to divide 1 to 100 numbers in such a way that every sons should get 10 cows who’s number sum up to 505.**Let us reduce the complexity of this puzzle using the below example:**

Now let us suppose you have 10 numbers and you hintoo divide it in to 5 people so that each one get equal sum of this numbers.so this 10 numbers sum up to 55 now each of the 5 people will get 11 as a sum so its obvious that every people will get two numbers whose sum is 11. so the division would be like this:

First_person —> 1, 10

Second_person —> 2, 9

Third_person —> 3, 8

Fourth_person —> 4, 7

Fifth_person —> 5, 6

so each person will get 11 .

Now coming back to the problem, we have 100 numbers we have to divide this in 10 groups so that each son get 505 litre of milk.So,

First_son —> 1, 2, 3, 4, 5, 96, 97, 98, 99, 100

Second_son —> 6, 7, 8, 9, 10, 91, 92, 93, 94, 95

Third_son —> 11, 12, 13, 14, 15, 86, 87, 88, 89, 90

Fourth_son —> 16, 17, 18, 19, 20, 81, 82, 83, 84, 85

Fifth_son —> 21, 22, 23, 24, 25, 76, 77, 78, 79, 80

Sith_son —> 26, 27, 28, 29, 30, 71, 72, 73, 74, 75

Seventh_son —> 31, 32, 33, 34, 35, 66, 67, 68, 69, 70

Eighth_son —> 36, 37, 38, 39, 40, 61, 62, 63, 64, 65

Ninth_son —> 41, 42, 43, 44, 45, 56, 57, 58, 59, 60

Tenth_son —> 46, 47, 48, 49, 50, 51, 52, 53, 54, 55

as the problem said each son should get equal amount of milk.

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the **DSA Self Paced Course** at a student-friendly price and become industry ready.