What is the output for the following java code? int index = 0; int result = 1; while ( true ) ++index; if (index % 2 = 0) continue; else if ( index % 5 0 break; result + 3; System.out.println (result); 6. 3. (D) This loop does not terminate

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter6: User-defined Functions
Section: Chapter Questions
Problem 34SA
icon
Related questions
Question
Question 6
What is the output for the following java code?
int index
int result = 1;
while ( true )
++index;
if ( index & 2 == 0 )
continue;
else if ( index % 5 == 0 )
break;
result += 3;
System.out.println (result);
6.
B.
3
7.
This loop does not terminate
Transcribed Image Text:Question 6 What is the output for the following java code? int index int result = 1; while ( true ) ++index; if ( index & 2 == 0 ) continue; else if ( index % 5 == 0 ) break; result += 3; System.out.println (result); 6. B. 3 7. This loop does not terminate
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Top down approach design
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
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning