You are given an integer , you have to convert it into a string.
Please complete the partially completed code in the editor. If your code successfully converts into a string the code will print "Good job". Otherwise it will print "Wrong answer".
can range between to inclusive.
Sample Input 0
100
Sample Output 0
Good job
Solution:
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
int n;
Scanner s=new Scanner(System.in);
n= s.nextInt();
try{
String str=String.valueOf(n);
System.out.println("Good job");
}catch(Exception e)
{
System.out.println("Wrong answer");
}
}
}
No comments:
Post a Comment