Created
March 4, 2016 04:20
-
-
Save w3farid/3223bbc260e643676a2f to your computer and use it in GitHub Desktop.
How to calculate Odd Even Number by java
This file contains 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
import java.util.Scanner; | |
public class OddEven { | |
public static void main(String[] args) { | |
Scanner sc=new Scanner(System.in); | |
System.out.println("Calculate the Odd or Even: "); | |
//check odd even number........... | |
int a=sc.nextInt(); | |
do{ | |
//check formula 10%2==0 ; | |
if (a%2==0) { | |
System.out.println("The number is Even."); | |
}else { | |
System.out.println("The number is Odd."); | |
} | |
a=sc.nextInt(); | |
}while(a>0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment