Computer Science, asked by narendraknj9651, 3 months ago

write a program to chek whether a short type number taken as input is an even number or an odd number​

Answers

Answered by abhikmal3696
1

Answer:

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");

}

}

Similar questions