remainder is 0 which means 4 is completely divisible by 2. On the other hand 15 is odd number because 15/2 will result in remainder as 1.
Program Code :
import java.util.Scanner;public class TestingEvenOdd{public static void main(String args[]){//scanner to get input from userScanner scn = new Scanner(System.in);System.out.printf("Enter any number : ");int number = scn.nextInt();if((number %2)==0){System.out.println("number "+number+" is even number");} else{System.out.println("number "+number+" is odd number");}}}
Output :
Enter any number : 15
number 15 is odd number