You are viewing a single comment's thread. Return to all comments →
import java.io.; import java.util.;
public class Solution {
public static void main(String[] args) { Scanner scan = new Scanner(System.in); int numeroCasoTeste = scan.nextInt(); for (int i = 0; i < numeroCasoTeste; i++) { if (scan.hasNextLong()) { long numero = scan.nextLong(); System.out.println(numero + " can be fitted in:"); if ((numero >= Byte.MIN_VALUE) && (numero <= Byte.MAX_VALUE)) System.out.println("* byte"); if ((numero >= Short.MIN_VALUE) && (numero <= Short.MAX_VALUE)) System.out.println("* short"); if ((numero >= Integer.MIN_VALUE) && (numero <= Integer.MAX_VALUE)) System.out.println("* int"); if ((numero >= Long.MIN_VALUE) && (numero <= Long.MAX_VALUE)) System.out.println("* long"); }else { String valorNaopermitido = scan.next(); System.out.println(valorNaopermitido + " can't be fitted anywhere."); } } } }
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 {