What is the output of the code fragment given below? int i; int j = 0; %3D for (i = 0; i <= 6; i++) { %3D if (i 8 2 == 0) { i = i + 2; j++; }

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter2: Using Data
Section: Chapter Questions
Problem 14RQ
icon
Related questions
Question
What is the output of the code fragment given below?
int i;
int j = 0;
for (i = 0; i <= 6; i++) {
if (i 8 2 == 0) {
i = i + 2;
j++;
}
else{
i++;
j = j + 2;
}
j++;
}
cout << "i=" << i < ", j=" < j;
a. i = 7, j = 12
O b. i = 8, j = 12
O c.i = 7, j = 8
%3D
%3D
d. i = 6, j = 9
%3D
Transcribed Image Text:What is the output of the code fragment given below? int i; int j = 0; for (i = 0; i <= 6; i++) { if (i 8 2 == 0) { i = i + 2; j++; } else{ i++; j = j + 2; } j++; } cout << "i=" << i < ", j=" < j; a. i = 7, j = 12 O b. i = 8, j = 12 O c.i = 7, j = 8 %3D %3D d. i = 6, j = 9 %3D
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT