+ 2

The output is 048 but I don't understand how anyone who understand plzz explain this...☺

for (int i=0 ; i < 10; i++ ) { if ( i% 4 == 0 ) { System. out.print(i) ; } }

1st May 2017, 7:23 AM
Nadir wadsariya
Nadir wadsariya - avatar
2 odpowiedzi
+ 13
i will take 0,1,2,3,.....,9 i will only get printed when i%4 is 0 , that is, when i/4 leaves remainder 0. this is true for values 0,4,8. hence 048 is printed
1st May 2017, 7:36 AM
Meharban Singh
Meharban Singh - avatar
0
You want only who's value that remainder is zero so in this case that are the values got remaining zero So it will printed in said scenario.....
11th May 2017, 5:09 AM
Babar
Babar - avatar