-
Notifications
You must be signed in to change notification settings - Fork 0
/
JavaDatatypes.java
36 lines (34 loc) · 1.12 KB
/
JavaDatatypes.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 0; i < n; i++) {
try {
long val = sc.nextLong();
System.out.println(val + " can be fitted in:");
if((val >= Byte.MIN_VALUE) && (val <= Byte.MAX_VALUE))
{
System.out.println("* byte");
}
if((val >= Short.MIN_VALUE) && (val <= Short.MAX_VALUE))
{
System.out.println("* short");
}
if((val >= Integer.MIN_VALUE) && (val <= Integer.MAX_VALUE))
{
System.out.println("* int");
}
if((val >= Long.MIN_VALUE) && (val <= Long.MAX_VALUE))
{
System.out.println("* long");
}
}
catch (Exception e)
{
System.out.println(sc.next() + " can't be fitted anywhere.");
}
}
}
}