Write the java code to accept a number and print whether it is even or odd.
pls answer fast
Answers
Answered by
2
import java.util.Scanner;
public class EvenOdd {
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
System.out.print("Enter a number: ");
int num = reader.nextInt();
if(num % 2 == 0)
System.out.println(num + " is even");
else
System.out.println(num + " is odd");
}
}
Mark as Brainliest
Similar questions