-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path09- Java Int to String.java
More file actions
46 lines (28 loc) · 983 Bytes
/
09- Java Int to String.java
File metadata and controls
46 lines (28 loc) · 983 Bytes
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
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
Problem statement:
https://www.hackerrank.com/challenges/java-int-to-string/problem
Problem
You are given an integer n, you have to convert it into a string.
Please complete the partially completed code in the editor. If your code successfully converts n into a string s the code will print “Good job”.
Otherwise it will print “Wrong answer”.
n can range between -100 to 100 inclusive.
Sample Input
100
Sample Output
Good job
*/
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
try{
Scanner sc = new Scanner (System.in);
int n = sc.nextInt();
String.valueOf(n);
System.out.print("Good job");
} catch (Exception e){
System.out.print("Wrong answer");
}
}
}