She has 24 friends.
Explanation
Suppose, the number of friends is [tex]x[/tex]
She gave 3 pieces of gum each of her friends. So, the total number of gums given to [tex]x[/tex] numbers of friends will be: [tex]3x[/tex]
She had total 77 pieces of gums and after giving to her friends, she has only 5 remaining. So, the equation will be......
[tex]3x+5=77\\ \\ 3x=77-5= 72\\ \\ x= \frac{72}{3}= 24[/tex]
So, she has total 24 friends.