package com.mycompany.chkoddeven;
import java.util.*;
public class ChkOddEven {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Input a number from 1-10: ");
int num = sc.nextInt();
int evenorodd = num%2;
if (evenorodd == 1) {
System.out.println("The number is Odd: " + num);
} else {
System.out.println("The number is Even: " + num);
}
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter