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