Solution Review: Even or Odd
In this review, the solution of the challenge 'Even or Odd' from the previous lesson is provided.
We'll cover the following...
Solution: is it even or odd? #
Press + to interact
class HelloWorld {public static void main( String args[] ) {int x = 3;String answer;if (x % 2 == 0) {answer = "even";}else {answer = "odd";}System.out.println(answer);}}
Understanding the Solution
Reasoning: An even number, when divided by 2, ...