-
Notifications
You must be signed in to change notification settings - Fork 1
/
GapfulNumbers.java
27 lines (25 loc) · 914 Bytes
/
GapfulNumbers.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
package SoloLearn;
public class GapfulNumbers {
public static boolean gapNum(int num) {
String stringed = Integer.toString(num);
String med = stringed.charAt(0) + "" + stringed.charAt(stringed.length()-1);
int div = Integer.parseInt(med);
return num % div == 0;
}
// public static void main(String[] args) {
// BufferedReader userInput = new BufferedReader(new InputStreamReader(System.in));
// System.out.println("Type in your number to check:");
// String input = "";
// String gapable;
//
// try {
// input += userInput.readLine();
// } catch (IOException e) {
// e.printStackTrace();
// }
//
// int number = Integer.parseInt(input);
// gapable = (gapNum(number)) ? "gapful" : "not gapful";
// System.out.println("You entered " + number + " and it's " + gapable);
// }
}