Number of chocolate distributed among friends = 40
He had distributed chocolate equally among 5 friends.
Lets apply repeated subtraction.
40 - 5 = 35
35 - 5 = 30
30 - 5 = 25
25 - 5 = 20
20 - 5 = 15
15 - 5 = 10
10 - 5 = 5
5 - 5 = 0
After 8 times 40 reduces to 0.
So each of his friend will get 8 chocolates.