2_Questions_6_2_while-1

2_Questions_6_2_while-1 - CIS 15AG Questions Chapter 6...

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

View Full Document Right Arrow Icon
CIS 15AG Questions Chapter 6: Repetitions (while) 7. Code the following flow chart fragment, then predict the output when x = 3, y = 13, and x = 13, y = 3. 8. Predict the output. char x = 'A'; while ( x < 'E' ) printf("%c\n", x++ ); char x = 'A'; while ( x < 'E' ) printf("%c\n", ++x ); 1 x y True READ x, y WRITE x x x - y int x, y; printf("Enter x and y: "); scanf("%d %d", &x, &y); printf("Now x is %d", x ); x y x y Output 3 13 -10 False -10 x y x y Output 13 3 -10 False -10
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 Questions Chapter 6: Repetitions (while) 9. Write a function for the following flow chart. All parameters are int . The first two are input parameters and the last two are output parameters. Desk-check the algorithm for x = 17, y = 5, then for x = 5, y = 17. What problem does this algorithm solve? 2 True x x - y q q + 1 q 0 x guess(x, y, q, r) return r x void quess( int x, int y, int *q, int *r ) { return; } x y q x y r 17 5 0 x y q x y r 5 17 0
Background image of page 2
CIS 15AG Questions Chapter 6:
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
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 / 5

2_Questions_6_2_while-1 - CIS 15AG Questions Chapter 6...

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

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