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

48 lines
826 B
Markdown
Raw Normal View History

2024-09-07 19:12:12 +00:00
# \#2
Directives:
```c
#include <stdio.h>
```
Statements:
```c
2024-09-07 19:15:57 +00:00
printf("Parkinson's Law: \nWork expands so as to ");
printf("fill the time\n");
printf("available for its completion.\n");
return 0;
```
Output:
```
Parkinson's Law:
Work expands so as to fill the time
available for its completion.
```
# \#5
(A): `100_bottles` is not a legal C identifier because C identifiers cannot start with a number.
# \#6
2024-09-07 19:20:57 +00:00
Double underscores are typically used to denote statements reserved by the compiler, and in C++, double underscores are used in name mangling and so they cannot be used entirely. More subjectively, it can be hard to tell how many underscores are present.
# \#7
(A): `for`
(E): `while`
# \#8
14.
Work:
1. `answer`
2. `=`
3. `(`
4. `3`
5. `*`
6. `q`
7. `-`
8. `p`
9. `*`
10. `p`
11. `)
12. `/`
13. `3`
14. `;`