This is a basic java program which checks whether the given number is even or odd.
PROGRAM :
OUTPUT :PROGRAM :
package codingcorner.in; import java.util.Scanner; public class EvenOrOdd { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Enter any number"); int number = scan.nextInt(); scan.close(); if (number % 2 == 0) System.out.println(number + " is EVEN number"); else System.out.println(number + " is ODD number"); } }
No comments:
Post a Comment