219k views
0 votes
Rewrite the following using if else statement:

int x;
String s=(x%3=0)? “Divisible by 3" : "Not divisible by 3";
System.out.println(s);​

1 Answer

1 vote
int x;
String s = “x%3=0?”
if( x%3 == 0){
s = “Divisible by 3”
}
else{
s = “Not divisible by 3”
}
System.out.println(s)
User Joseph Wood
by
6.4k points