title: Displaying an output in Ruby to 2 decimal places
body: <p>I want to display a price such that if the answer is 10.1 the ouput would be 10.10 and if the answer is 20, the output would be 20.00</p>
  
  <p>I have gone through the forums and used so many <a href="https://stackoverflow.com/questions/15900537/to-d-to-always-return-2-decimals-places-in-ruby">examples</a> but it still hasn't worked for me. The answer is for rails but I am working on Ruby.<code>s=  '%2f' % @price</code> and the output I get is <code>12.100000</code></p>