- Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathSimpleEvens.java
29 lines (25 loc) · 767 Bytes
/
SimpleEvens.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
importjava.util.*;
importjava.io.*;p
classMain {
publicstaticbooleanSimpleEvens(Longnum) {
// code goes here
Stringstr = String.valueOf(num);
char[] arr = str.toCharArray();
booleanresult = true;
for (inti = 0; i < arr.length; i++) {
if (getDigit(arr[i]) % 2 != 0) {
result = false;
break;
}
}
returnresult;
}
publicstaticintgetDigit(charch) {
returnCharacter.getNumericValue(ch);
}
publicstaticvoidmain (String[] args) {
// keep this function call here
Scanners = newScanner(System.in);
System.out.print(SimpleEvens(s.nextLine()L));
}
}