Do practice.
go to the java link: click here
Source Code:
- public class EvenOddDemo {
- public static void main(String[] args) {
- try (// TODO Auto-generated method stub
- Scanner input = new Scanner(System.in)) {
- int num;
- System.out.print("Enter the number: ");
- num = input.nextInt();
- if(num %2==0) {
- System.out.println("The number is Even.");
- }
- else {
- System.out.println("The number is odd.");
- }
- }
- }
- }
Output:
Enter the number: 84553
The number is odd.
Enter the number: 1548856
The number is Even.
0 comments:
Post a Comment