Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

odd number in java

import java.util.Scanner;

public class Exam{
	public static void main(String[] args){
    
		Scanner scan = new Scanner(System.in);
        System.out.println("Enter number");
		int input = scan.nextInt();
		if(input % 2 != 0){
        	System.out.println(input + " is odd");
	      }
		else
			System.out.println(input + " is even");
	}
}	
 
PREVIOUS NEXT
Tagged: #odd #number #java
ADD COMMENT
Topic
Name
9+3 =