0
Output question
boolean b=true; for(int i=0;i<10;i++) if(b!=b) System.out.print(i);
9 odpowiedzi
+ 4
Àçhîñtyà Ràj
Try to do a double check, whether the condition was `if( b != b )` or `if( b = !b ) ` these two are working differently. The latter supposedly give output as you described.
+ 2
Àçhîñtyà Ràj
There is b = !b so after iteration the value of b will change. That's why output is
1 3 5 7 9
+ 1
Ok thanks
0
No but it is showing output 13579
0
Reason I don't know
0
Yes u are right but this question was asked in a challenge and there was no option available as no output and the correct answer was 13579
0
Àçhîñtyà Ràj
See here after every iteration value of b is changing
https://code.sololearn.com/ceE69hdiDc5D/?ref=app
0
Yes sorry everyone by mistake
0
It was b=!b