-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhackerrank.cpp
37 lines (34 loc) · 1 KB
/
hackerrank.cpp
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
#include <iostream>
#include <climits>
using namespace std;
int main(){
int itr;
cin >> itr;
double num[itr];
for(int i = 0; i < itr ; i++){
cin >> num[i];
}
for(int i = 0 ; i < itr;i++){
if(LLONG_MIN > num[i] || num[i] > LLONG_MAX ){
cout << num[i] << " can't be fitted anywhere";
}
else{
cout << num[i] << " can be fitted in:" << endl;
if(CHAR_MIN <= num[i] && num[i] <= CHAR_MAX){
cout << "* char" << endl;
}
if(SHRT_MIN <= num[i] && num[i] <= SHRT_MAX){
cout << "* short int" << endl;
}
if(INT_MIN<= num[i] && num[i] <= INT_MAX){
cout << "* int" << endl;
}
if(LONG_MIN <= num[i] && num[i] <= LONG_MAX){
cout << "* long int" << endl;
}
if(LLONG_MIN <= num[i] && num[i] <= LLONG_MAX){
cout << "* long long int" << endl;
}
}
}
}