Created
December 5, 2021 06:23
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //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