Find the output for the given snippet:
for(I=1;I<=5;I++);
{
for(j=1;j<=5;j++);
{
System.out.println("Congrats!!anindyadikari you won the challenge");
}
}
Answers
Answered by
2
Question:-
- Find the output of the given snippet.
Solution:-
Given code,
int I, j;
for(I=1;I<=5;I++);
{
for(j=1;j<=5;j++);
{
System.out.println("Congrats!! Anindya Adhikari you won the challenge");
}
}
This is a very tricky question, many students will make the mistake by not seeing the semicolon at the end of the loop.
Many students will write(by mistake) that the output is,
"Congrats!! Anindya Adhikari you won the challenge" printed 25 times.
But, the actual output is:- Congrats!! Anindya Adhikari you won the challenge.
Output:-
- Congrats!! Anindya Adhikari you won the challenge
Similar questions
Computer Science,
3 months ago
Hindi,
6 months ago
Social Sciences,
6 months ago
English,
11 months ago
English,
11 months ago