3_Answers_6_1_do_while-1

3_Answers_6_1_do_while-1 - CIS 15AG Answers Chapter 6:...

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

View Full Document Right Arrow Icon
CIS 15AG Answers Chapter 6: Repetitions (do … while) 1. Code the following flow chart fragment, then predict the output when x = 3, y = 13, and x = 13, y = 3. 2. Predict the output. x = 1; do x *= 2; while ( x < 35 ); printf("%d\n", x ); x = 100; do x /= 2; while ( x > 3 ); printf("%d\n", x ); 1 x x - y True READ x, y WRITE x int x, y; printf("Enter x and y: "); scanf("%d %d", &x, &y); do x = x – y; while ( x >= y ); printf("Now x is %d", x ); x y x y Output 3 13 -10 False -10 1 iteration -10 False -10 x y x y Output 13 3 10 True 7 True 4 True 1 False 1 4 iterations x x < 35 Output 1 2 True 4 True 8 True 16 True 32 True 64 False 64 6 iterations x x > 3 Output 100 50 True 25 True 12 True 6 True 3 False 3 5 iterations
Background image of page 1

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

View Full DocumentRight Arrow Icon
CIS 15AG Answers Chapter 6: Repetitions (do … while) 3. Code the following flow chart fragment, then predict the output when x = 3, y = 13, and x = 13, y = 3. 4. Predict the output.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/02/2011 for the course CIS 15BG taught by Professor Staff during the Spring '10 term at DeAnza College.

Page1 / 4

3_Answers_6_1_do_while-1 - CIS 15AG Answers Chapter 6:...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online