2_Questions_6_2_while-1

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

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

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

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

View Full Document
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
CIS 15AG Questions Chapter 6:

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### 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
Ask a homework question - tutors are online