Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package javaapplication1;
- import java.util.Scanner;
- public class JavaApplication1 {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- boolean charMai = false;
- int num2 = 0;
- do {
- System.out.print("Input even number :");
- String inputString = sc.next();
- charMai = false;
- for (char ch : inputString.toCharArray()) {
- if (ch < '0' || ch > '9') {
- charMai = true;
- break;
- }
- }
- if (!charMai) {
- num2 = Integer.parseInt(inputString);
- }
- } while (!charMai && num2 % 2 == 0);
- System.out.println("Program shutdown");
- }
- }
Add Comment
Please, Sign In to add comment