- 1
Write an algorithm to find whether a number entered by a user is even or odd ? Hint: Even numbers are divisible by 2.
2 Answers
+ 6
Hint: "%" is the remainder operator.
+ 2
if ((x % 2) == 0)
System.out.println("Number is even");
else
System.out.println("Number is odd");