How to Eliminate Coins when Answer button is clicked and Answer will be shown

I'm trying to create a quiz contains answer where user click on the Answer button and 50 coins will be eliminated. When user click on theAnswer button it will prompt user whether the user really need the answer. If user click 'Yes', it will eliminate 50 coins and the answers will be shown. How should I write it? **"#Ans"+i is getting answers from the database in Ans table.

The code below only shown when user click on Answer and the answer will appear without eliminating the coins. How to add the code for eliminate 50 coins?

  @{int i = 0;}
  @foreach (var item in Model)
     <a href="@("#Ans"+i)" id="hint" data-toggle="collapse">Answer</a>
        <div id="@("Ans"+i)" class="collapse">
            <span style=" border: 1px solid; background-color:      
                 #E0E0E0;font-size: 15px;">
              Answer:B
            </span>
        </div>

   i++;
 }