int i;
for(i = 5; i< = 20; i+=5)
if( i % 3 == 0)
continue;
System.out.println(i);
find the output
Answers
Answered by
4
Required Answer:-
Given C∅de Snippet:
int i;
for(i=5;i<=20;i+=5) {
if(i%3==0)
continue;
System.out.println(i);
}
To Find:
- Output of the following program. (Language - Java).
Output:
5
10
20
Explanation:
- The given loop iterates from i = 5 to 20 and after each iteration, value of i is incremented by 5. Now, if i is divisible by 3, then the continue statement will be executed and thus, the value of i will not be displayed. When i = 15, i % 3 == 0 is true. So, 15 will not be displayed on the screen.
Hence, output goes like -
5
10
20
Refer to the attachment.
Attachments:
Similar questions