Question: Jojo just learnt about 2 data types in C which is integer and long long. He know that at most an integer can hold at

Jojo just learnt about 2 data types in C which is integer and long long. He know that at most an integer can hold at most an absolute value of 2147483647 and long long at most 9223372036854775807. Unfortunately, he sometimes forget the maximum value that can be hold by integer or long long, So he ask you to help him.

Format Input: The first line contain an integer T represent how many number that he want to check. The next T lines consist of a number that he want to check what is the most efficient memory data type to hold X.

Format Output: Consist of T lines. Each line output have format "Case #A : B" where B represent test case number and A is a string between "integer" or "long long".

Constraints -9,223,372,036,854,775,807 <= x <= 9,223,372,036,854,775,807

Sample input | Sample output

2

3 | Case #1: integer

2147483649 | Case #2: long long

This is what I tried:

#include

int main(){

int x; //case number

signed long long int y; //actual number

int a=0; //case counter

int b=1; //case number

char nll[8]= "integer";

char ll[10]= "long long";

scanf("%d", &x);

do{

scanf("%d", &y);

if(y>2147483647 || y<-2147483647){ //if is more than that value

printf("Case #%d: %s ", b, ll); //prints string long long

b++;

a++;}

else{

printf("Case #%d: %s ", b, nll); //prints string integer

b++;

a++;}

}

while(a

}

Why does this not program reigister all negative numbers as 'long long'?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!