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