This is a Java program that determines if a number is odd or even. Here's how it works:
import java.util.Scanner; public class Odd_Even { public static void main(String[] args) { Scanner input = new Scanner(System.in); int num = 0; System.out.printf("Enter the Number : "); num = input.nextInt(); switch (num % 2) { case 0: System.out.printf("This is a Even Number"); break; case 1: System.out.printf("This is a Odd Number"); break; } } }
Enter the Number : 23 This is a Odd Number
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions