We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
hey i dont know why the code is not running properly :
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. */
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for(int i = 0; i < t; i++){
try{
long a = sc.nextLong();
System.out.println(a+" can be fitted in:");
if(a >= Byte.MIN_VALUE && a <= Byte.MAX_VALUE){
System.out.println("* byte");
}
if(a >= Short.MIN_VALUE && a <= Short.MAX_VALUE) {
System.out.println("* short");
}
if(a >= Integer.MIN_VALUE && a <= Integer.MAX_VALUE){
System.out.println("* int");
}
if (a >= Long.MIN_VALUE && a <= Long.MAX_VALUE) {
System.out.println("* long");
}
}catch(Exception e){
String x = sc.next();
System.out.println(x+" can't be fitted anywhere.");
}
}
sc.close();
}
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java Datatypes
You are viewing a single comment's thread. Return to all comments →
hey i dont know why the code is not running properly :
import java.io.; import java.util.;
public class Solution {
}