if else
Write a program to check a number is even or odd.
import java.util.Scanner; class P09IfElse { public static void main(String args[]) { int x; System.out.println("Enter one integers to check even or odd"); Scanner in = new Scanner(System.in); x = in.nextInt(); if(x%2==0) System.out.println( x + " is even "); else System.out.println( x + " is odd "); } }
Comments
Post a Comment