Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke

1st Edition

0130086509, 978-0130086501

More Books

Students also viewed these Databases questions