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.
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 NumberOfInput= sc.nextInt();
for (int i = 0; i < NumberOfInput; i++) {
try{
Long InputValue= sc.nextLong();
System.out.println(InputValue+" "+"can be fitted in:");
if (InputValue>=Byte.MIN_VALUE &&InputValue<=Byte.MAX_VALUE) {
System.out.println("* byte");
}
if (InputValue>=Short.MIN_VALUE &&InputValue<=Short.MAX_VALUE) {
System.out.println("* short");
}
if (InputValue>=Integer.MIN_VALUE &&InputValue<=Integer.MAX_VALUE) {
System.out.println("* int");
}
if (InputValue>=Long.MIN_VALUE && InputValue<=Long.MAX_VALUE) {
System.out.println("* long");
}
}catch(Exception e){
System.out.println(sc.next() +" "+"can't be fitted anywhere.");
}
}
}
}
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 →
import java.io.; import java.util.;
public class Solution {
}