What does the program print to the monitor?

A good answer might be:

The variable contains: 123

Assignment Statement Syntax

This program printed out the same thing as the first example program. However, this program did not initialize the variable and so had to put a value into it later.

The syntax of assignment statements is easy. Assignment statements look like this:


variableName  =  expression;
  • The equal sign "=" means "assignment."
  • variableName is the name of a variable that has been declared somewhere in the program.
  • expression is a collection of characters that calls for a value.

An assignment statement asks for the computer to perform two steps, in order:

  1. Evaluate the expression (that is: calculate a value.)
  2. Store the value in the variable.

For example, the assignment statement:

sum = 32 + 8 ;
asks for two actions:
  1. Evaluate the Expression --- 32 + 8 is calculated, yielding 40.
  2. Store the value in the variable. 40 is placed in sum

QUESTION 11:

What does the following assignment statement statement do:

sum = 42 - 12 ;

Click Here after you have answered the question