- 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

27th Nov 2020, 6:59 AM
Liason Ngayan
Liason Ngayan - avatar
1 Respuesta
+ 3
You can check if a number is even or odd using the modulo % operator. if (num % 2 == 0) { ... even } else { ... odd }
27th Nov 2020, 7:03 AM
ChaoticDawg
ChaoticDawg - avatar