Send Close Add comments: (status displays here)
Got it!  This site uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.nbsp; Note: This appears on each machine/browser from which this site is accessed.
Statements with variables


1. Statements with variables
This page has some examples and questions involving assignment statements with variables.

2. Example 1
Here is the C code.

Here are the final values of the variables in the program (main).
d == 4 h == 3 z == 1 b == 4 c == 10

The final value of variable c is 10. The output is the remainder left over when c is divided by 10, which is 0 (the answer). Here is the output of the C code.


3. Example 2
Here is the C code.

Here are the final values of the variables in the program (main).
d == 5 p == 4 z == 15 m == 3 b == 10

The final value of variable b is 10. The output is the remainder left over when b is divided by 10, which is 0 (the answer). Here is the output of the C code.


4. Example 3
Here is the C code.

Here are the final values of the variables in the program (main).
e == 4 w == 3 a == 9 h == 2 y == 18

The final value of variable y is 18. The output is the remainder left over when y is divided by 10, which is 8 (the answer). Here is the output of the C code.


5. End of page

6. Multiple choice questions for this page