-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHackerrankJava0010.java
More file actions
33 lines (26 loc) · 1.15 KB
/
HackerrankJava0010.java
File metadata and controls
33 lines (26 loc) · 1.15 KB
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
30
31
32
33
import java.util.Scanner;
public class HackerrankJava0010 {
public static void main(String[] args) {
// Java Int to String
// https://www.hackerrank.com/challenges/java-int-to-string/problem?isFullScreen=true
try {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
in.close();
// ------------------------------------------------------------------------------------------------
// --- You need to add this line for solution hackerrank provides all other lines for challange ---
// ------------------------------------------------------------------------------------------------
String s = String.valueOf(n);
// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
if (n == Integer.parseInt(s)) {
System.out.println("Good job");
} else {
System.out.println("Wrong answer.");
}
} catch (Exception e) {
System.out.println("Unsuccessful Termination!!");
}
}
}