The assignment statement in line 19
sum = number1 + number2; // add the numbers; store result in sum
adds the values of variables number1
and number2
and assigns the result to variable sum
using the assignment operator =. We like to read this statement as, “sum
gets the value of number1 + number2
.” Most calculations are performed in assignment statements. The =
operator and the +
operator are binary operators—each has two operands. In the case of the +
operator, the two operands are number1
and number2
. In the case of the preceding =
operator, the two operands are sum
and the value of the expression number1 + number2
.
3.144.86.134