{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

What is the Output Exercises Chapter 02

# What is the Output Exercises Chapter 02 - What is the...

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

What is the Output Exercices Chapter 02 1 1. What is the output of the following program ? #include <iostream.h> void main () { int x = 1; for ( ; ; ) { if ((x++ % 15) == 0) break ; if ((x % 5) != 0) continue ; cout << x << " "; } cout << endl; } Answer : If we had: if ((++x % 15) == 0) then the answer would be:

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

View Full Document
What is the Output Exercices Chapter 02 2 2. What is the output of the following program ? #include <iostream.h> void main () { int x = 10; while ( x ) { if ( --x == 5 ) break ; cout << x << " "; } cout << endl; } Answer : If we had: if (x-- == 5) then the answer would be:
What is the Output Exercices Chapter 02 3 3. What is the output of the following program ? #include <iostream.h> void main () { int x = 10; while ( x ) { cout << --x << " "; } cout << endl; } Answer : If we had: cout << x-- << " "; then the answer would be:

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

View Full Document
What is the Output Exercices Chapter 02 4 4. What is the output of the following program ? #include <iostream.h> void main () { int j; for ( j = 1; j <= 10; j++ ) { if ( (j > 5) && (j <= 7) ) cout << j << endl; } cout << endl; } Ans8wer : 5. What is the output of the following program ? #include <iostream.h> void main () { int j; for ( j = 1; j <= 10; j++ ) { if ( (j > 5) || (j <= 7) ) cout << j << endl; } cout << endl; } Answer :
What is the Output Exercices Chapter 02 5 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 / 10

What is the Output Exercises Chapter 02 - What is the...

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

View Full Document
Ask a homework question - tutors are online