Answer:

Step-by-step explanation:
As per mechanical energy conservation we can say that here since friction is present in the barrel so we will have
Work done by friction force = Loss in mechanical energy
so we will have

here we know that



Initial compression in the spring is given as



now from above equation



