0
How does modulo work please if i entered 10 in this if statement.
If(scn%2==0){System.out.println("even");}
2 Respuestas
+ 9
Modulus (%) operator returns the division remainder (what is left over).
10 divided by 2 gives 0 as a remainder ( 2*5 = 10, 10-10 = 0 ).
Therefore,
if( 10%2 == 0 ) { // condition true
System.out.println("even"); //outputs even
}
It's the basic Math in which we divide two numbers for getting a remainder :D
0
ohhhh cool i get it thanks