profit percentage formula code example Example: profit formula total revenue – total expenses = profit