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

38 lines
340 B
Markdown
Raw Normal View History

2024-09-11 18:06:34 +00:00
# 1.
2024-09-11 17:56:34 +00:00
a. `86,1040`
b. `3.02530e+01`
c. `83.1620`
2024-09-11 18:06:34 +00:00
d. `1e-06 `
# 2.
2024-09-11 18:11:34 +00:00
```c
float x = 0.12345;
// a
2024-09-11 18:16:34 +00:00
printf("%-8.1e", x);
2024-09-11 18:11:34 +00:00
// b
2024-09-11 18:16:34 +00:00
printf("%10.6e", x);
2024-09-11 18:11:34 +00:00
// c
printf("%8.3f", x);
// d
2024-09-11 18:16:34 +00:00
printf("%-6.0f", x);
2024-09-11 18:11:34 +00:00
```
2024-09-11 18:16:34 +00:00
# 3.
2024-09-11 18:46:34 +00:00
a. Equivalent
b. Equivalent
c. Equivalent
d. Equivalent
# 4.
`i`: `10`
2024-09-11 18:51:34 +00:00
`x`: `0.3f`
`j`: `5`
# 5.
`x`: `12.3f`
`i`: `45`
`f`: `0.6f`
2024-09-11 18:46:34 +00:00