You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You are given an integer nn, you have to convert it into a string.
3
+
4
+
Please complete the partially completed code in the editor. If your code successfully converts nn into a string ss the code will print "Good job". Otherwise it will print "Wrong answer".
5
+
6
+
nn can range between −100−100 to 100100 inclusive.
7
+
*/
8
+
9
+
importjava.util.*;
10
+
importjava.security.*;
11
+
publicclassIntToString {
12
+
publicstaticvoidmain(String[] args) {
13
+
14
+
Do_Not_Terminate.forbidExit();
15
+
16
+
try{
17
+
Scannerin = newScanner(System.in);
18
+
intn=in.nextInt();
19
+
Strings = Integer.toString(n);
20
+
if(n==Integer.parseInt(s))
21
+
{
22
+
System.out.println("Good job");
23
+
}
24
+
else
25
+
{
26
+
System.out.println("Wrong answer.");
27
+
}
28
+
}
29
+
catch (Do_Not_Terminate.ExitTrappedExceptione) {
30
+
System.out.println("Unsuccessful Termination!!");
31
+
}
32
+
}
33
+
}
34
+
35
+
//The following class will prevent you from terminating the code using exit(0)!
0 commit comments