Java program to determine even or odd number

Write a Java program to check whether a number is even or odd

Let’s see how to write a Java program to check whether a given number is even or odd by using if-else. Java program to determine even or odd number import java.util.Scanner;public class Evenodd {public static void main(String args[]){int a;Scanner sc = new Scanner(System.in);System.out.println(“Enter the number to be tested :: “); a = sc.nextInt();if( a%2 == […]

Scroll to top
error: physicsTeacher.in