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 conditional statements


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

2. Example 1
Here is the C code.

Here are the final values of the variables in the program (main).
m == 6 c == 4 p == 20 t == 0 z == 8

The final value of variable z is 8. The output is the remainder left over when z is divided by 10, which is 8 (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 == 4 k == 3 h == 2 e == 10 f == 15

The final value of variable f is 15. The output is the remainder left over when f is divided by 10, which is 5 (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).
m == 4 x == 6 r == 11 n == 18 d == 1

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


5. End of page

6. Multiple choice questions for this page