How to check if my integer can be divided by 3 as below:
for(int i=0; i<24; i++){
//here, how to check if \"i\" can be divided by 3 completely(e.g. 3,
inside the loop:
if (i%3 == 0)
// it can be divided by 3
%
is called "mod" or "modulus" and gives you the remainder when dividing two numbers.
These are all true:
6 % 3 == 0
7 % 3 == 1
7 % 4 == 3
if( i % 3 == 0 ){
System.out.println("can be divided by 3");
}else{
System.out.println("cant divide by 3");
}
Is this question for real?