hw2_solution

# hw2_solution - EME5 Homework 2 Solutions October 8 2010 3...

This preview shows pages 1–3. Sign up to view the full content.

EME5 Homework 2 Solutions October 8, 2010 3 Chapter 3, Problem 1 3.1 Part b 0154, 108, 0x6c 3.2 Part g 042132, 17498, 0x445A 3.3 Part h 0242132, -48038, 0x1445A 4 Chapter 3, Problem 2 4.1 Part c 0b 0000 0000 0000 0000 0000 0000 0000 0010 4.2 Part d 0b 1111 1111 1111 1111 1111 1111 1111 1110 4.3 Part g 0b 0000 0000 0000 0000 0000 0000 0000 0101 4.4 Part h 0b 1111 1111 1111 1111 1111 1111 1111 1011 4.5 Part m 0b 0000 0000 0000 0000 0000 0000 0000 1010 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4.6 Part n 0b 1111 1111 1111 1111 1111 1111 1111 0110 5 Chapter 3, Problem 5 5.1 Part j scanf("%lf", &d); 5.2 Part l Decimal value is lost when a double is assigned to an integer. Type-casting the int to double cannot bring back the original decimal value. Only 123.000000 can be printed. 6 Chapter 3, Problem 7 6.1 Solution Code #include <stdio.h> int main() { /* Part d */ printf("%d\n",3/2); /* Part f */ printf("%d\n",2/3); /* Part j */ printf("%.6f\n",1.0/3); printf("%.20f\n",1.0/3); return 0; } 6.2 Solution Output 1 0 0.333333 0.33333333333333331000 7 Chapter 3, Problem 14 7.1 Solution Code #include <stdio.h> 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 6

hw2_solution - EME5 Homework 2 Solutions October 8 2010 3...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online