ria distributes sweets to three girls one by one . she gives half of the tofees to each girl. if she is left with three tofees in the end ,how manytofees she had in the beginning.

x - x/2 - x/4 - x/8 = 3

x = 24

To solve this problem, let's assume that Ria initially had "x" number of toffees.

According to the information given, Ria gives half of the toffees to each girl. So, she gives "x/2" toffees to the first girl. This leaves her with "(x - x/2)" toffees.

Now, Ria gives half of the remaining toffees to the second girl. Therefore, she gives "(x - x/2)/2" toffees to the second girl. This leaves her with "(x - x/2 - (x - x/2)/2)" toffees.

Finally, Ria gives half of the remaining toffees to the third girl, leaving her with 3 toffees.
So, we can set up an equation:
(x - x/2 - (x - x/2)/2)/2 = 3

Now, let's solve it step by step:
1. Simplify the equation:
((2x - x) - (2x - x)/2)/2 = 3
(x - (x)/2)/2 = 3
(x/2)/2 = 3
(x/4) = 3

2. Multiply both sides of the equation by 4 to isolate x:
4 * (x/4) = 4 * 3
x = 12

Therefore, Ria initially had 12 toffees in the beginning.