Some questions on assignment statements
- What is wrong with the following assignment statements?
- x == i+3;
Comparison operator (==) used instead of assignment (=).
- j = i * j
Semi-colon missing at the end of the statement.
- i + 3 = j -k;
left hand side of the assignment is not a variable, but an expression
instead.
- Write a program to read in three numbers, find their mean and range
and write out the original numbers and the two results calculated.
A sample solution is here.
Some answers to these questions.
Back to the notes on assignment.