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.
This page has some examples and questions involving assignment statements with conditional expressions. The condition expression uses what is called the ternary operator which is a "?" (question mark).
Here are the final values of the variables in the program (main).
p == 4
z == 6
b == 11
q == 0
c == 1
The final value of variable c is 1. The output is the remainder left over when c is divided by 10, which is 1 (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).
x == 3
k == 7
e == 0
d == 7
h == 30
The final value of variable h is 30. The output is the remainder left over when h 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).
w == 7
x == 4
r == 35
t == 10
a == 4
The final value of variable a is 4. The output is the remainder left over when a is divided by 10, which is 4 (the answer).
Here is the output of the C code.