Java Int to String : Hacker Rank Solution : Digit Wood


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 0

Sample Output 0


import java.util.*;

public class Solution {

public static void main(String[] args) 
    Scanner tc = new Scanner (;
    int n;
    n= tc.nextInt();
    if (n < 100 || n > -100 )
        String nString = "" + n;
        System.out.print ("Good job");
        System.out.print ("Wrong answer");


Leave a Reply

Your email address will not be published. Required fields are marked *