Its fairly simple just create a var to hold your total.
Add all the numbers together
Divide by the number of numbers used.

Code:
T=x+y+z
A=T/3