Create Computed Field?

In my custom content have three fields :
E.g.-

  1. number of = 4
  2. price = $ 2
  3. Sub Total = 4 * 2

How to make the subtotal field as computed field and how to implement it.?