Why doesn't the code "int a = 1000, b = 1000;
long int c = a * b;" work?

Answer Posted / thirupathi reddy katkoori

Integer range exceeds if multiply both the variables the resultant value does not to store it. Due to exceeding the int range only we have to declare it as long int and the value is store in c

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the types of variables in c?

756


What are the modifiers available in c programming language?

964


how can I convert a string to a number?

776


What is difference between main and void main?

844


What are high level languages like C and FORTRAN also known as?

895


What are the advantages and disadvantages of a heap?

895


What functions are used in dynamic memory allocation in c?

781


Is exit(status) truly equivalent to returning the same status from main?

806


What are the parts of c program?

834


What is a pointer variable in c language?

825


What is floating point constants?

875


When should a type cast be used?

755


Why isn't any of this standardized in c? Any real program has to do some of these things.

898


Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

845


Are there any problems with performing mathematical operations on different variable types?

775