Number is even or odd in java

 


package com.company;

import java.util.Scanner;

public class Main {

public static void main(String[] args) {
// write your code here
int a ;
System.out.println("Enter a number : ");
Scanner sc = new Scanner(System.in);
a =sc.nextInt();

if (a%2==0)
{
System.out.println("Even number");
}
System.out.println("Odd number");
}
}
Enter a number : 
23
Odd number

Process finished with exit code 0

Comments

Popular posts from this blog

the distance between two cities (in km is input through the keyboard. write a program to convert and print this distance in meter ,feet inches and centimeter.

Phone Dictionary Application in c

BITWISE OPERATOR