- 1
Java problem?I need Help.
I'm quite into games now, so how about we play In or Out ! When a giving numbers is given the team scores so we shall print "In", but if it's not an even number then we print "Out", Input format : A line containing an integer Input sample: 35
1 Answer
+ 3
You can check if a number is even or odd using the modulo % operator.
if (num % 2 == 0) {
... even
} else {
... odd
}