A condition chooses which statements run. Only one path is taken on a given input.
A conditional is a fork in the road. The program looks at a test and then takes only one path: the if body, an else if, or the leftover else. The other paths are skipped completely on this run.
C chooses a path with if / else or with switch. This run uses if / else if / else.
Open-ended tests: ranges, several variables, or n > 0. First true branch wins.
Exact integer (or char) labels. Put break after each case or execution falls through.
A one-line choose: x = n > 0 ? 1 : -1;. Not a replacement for long if chains.
the value we test
Could have come from scanf in a real program.first test
False, so skip Positive.second test
True, so this branch owns the output.the taken path
Zero is never printed.Each step highlights the matching C line. Program output appears only when a line that prints actually runs.
Five questions. Pick one answer each, then Check answers. The correct choice turns green.
1. How many branches print for one input?
First true match.
2. Sample n = -3 prints:
n < 0.
3. else is for:
Default path.
4. switch is best when:
Exact cases.
5. if (n = 0) is usually a bug because:
Use ==.