go to previous page   go to home page   go to next page hear noise highlighting

What does the program print to the monitor?

Answer:

The variable contains: 123

The program prints 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.


Assignment Statement Syntax

Assignment statements look like this:

variableName  =  expression ;

Here are some example assignment statements (assume that the variables have already been declared):

total = 3 + 5;

price = 34.56;

tax = total*0.05;

In the source file, the variable must be declared before any assignment statement that uses that variable.


QUESTION 11:

Is the following correct?

int sum;

sum = 42 - 12 ;

go to previous page   go to home page   go to next page