Skip to content

Instantly share code, notes, and snippets.

@Deshan555
Created December 5, 2021 06:23
Show Gist options
  • Select an option

  • Save Deshan555/28100e9b46088decb6f48863c724843b to your computer and use it in GitHub Desktop.

Select an option

Save Deshan555/28100e9b46088decb6f48863c724843b to your computer and use it in GitHub Desktop.
Write a java program to check whether a number is even or odd.
//Write a Java program to check whether a number is even or odd
import java.util.Scanner;
public class pro2
{
public static void main(String[] args)
{
Scanner innum = new Scanner(System.in);
System.out.print("Enter your number :");
int number = innum.nextInt();
int reminder = number % 2;
if (reminder == 0)
{
System.out.print("Even Number");
}
else
{
System.out.print("Odd Number");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment