asked 4.1k views
1 vote
What will the following program segment display? int funny = 7, serious = 15; funny = serious % 2; if (funny != 1) { funny = 0; serious = 0; } else if (funny == 2) { funny = 10; serious = 10; } else { funny = 1; serious = 1; } cout << funny << " " << serious << endl;

asked
User Foitn
by
7.9k points

2 Answers

4 votes

Answer:

11

Step-by-step explanation:

answered
User Hahcho
by
9.1k points
4 votes

Answer:

1 1

Step-by-step explanation:

The statement funny = serious % 2 assigns 1 to funny, since the remainder of 15 divided by 2 is 1.

Then the last else clause of the program kicks in, assigning 1 to both funny and serious.

answered
User Nickbusted
by
8.6k points

No related questions found