From 0ac24032c0a2706db6d5f6387dd2f7f761548eac Mon Sep 17 00:00:00 2001 From: zleyyij <75810274+zleyyij@users.noreply.github.com> Date: Wed, 18 Sep 2024 11:42:12 -0600 Subject: [PATCH] vault backup: 2024-09-18 11:42:12 --- .../software development/ECE1400/Chapter.md | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/education/software development/ECE1400/Chapter.md b/education/software development/ECE1400/Chapter.md index d8e024d..2183477 100644 --- a/education/software development/ECE1400/Chapter.md +++ b/education/software development/ECE1400/Chapter.md @@ -40,9 +40,23 @@ printf("%d", i < j || k); ``` > 6. Is the following `if` statement legal? - ```c -if (n >= 1 <= 10) +if (n == 1-10) printf("n is between 1 and 10\n"); ``` -Yes the statement is *legal*, but it does not produce the intended effect. It would produce an output when `n` is zero because `0 >= 1` would evaluate to `0`, and `0 <= 10` is false. \ No newline at end of file + +Yes the statement is *legal*, but it does not produce the intended effect. It would not produce an output when `n = 5`, because `1-10` evaluates to `-9`, and `-9 != 5`. + +> 10. What output does the following program fragment produce? (Assume that `i` is an integer variable.) +```c +int i = 1; +switch (i % 3) { + case 0: printf("zero"); + case 1: printf("one"); + case 2: printf("two"); +} +``` + +The program would print `onetwo` because each case is missing a `break` statement. + +> 11. The following table shows the telephone ar \ No newline at end of file