Answer: he had 50 marbles at first.
Step-by-step explanation:
Let x represent the number of marbles that he had at first.
He gave 2/5 of his marble to his neighbour. It means that the number of marbles that he gave to his neighbour is 2/5 × x = 2x/5
The number of marbles that he has remaining is
x - 2x/5 = 3x/5
He gave 1/6 of the remainder to his friend Ali. It means that the number of marbles that he gave to his friend is
1/6 × 3x/5 = x/10
The number of marbles that he has left is
3x/5 - x/10 = 5x/10
He had 25 marbles left. It means that
5x/10 = 25
5x = 25 × 10 = 250
x = 250/5 = 50