notes/education/software development/ECE1400/Chapter.md

9 lines
347 B
Markdown
Raw Normal View History

2024-09-18 16:52:12 +00:00
> 2. The following program fragments illustrate the logical operators. Show the output produced by each, assuming that `i`, `j`, and `k` are `int` variables.
a. `i = 10; j = 5;`
2024-09-18 17:12:12 +00:00
```c
2024-09-18 16:57:12 +00:00
printf("%d", !i < j);
2024-09-18 17:12:12 +00:00
// Expected output: `1`, because `!i` evaluates to 0, and 0 is less than 5, so that expression evaluates to true, or 1.
```
b. `i = 2; j = `