Someone please explain the output of this code. It is giving output different what i expected | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Someone please explain the output of this code. It is giving output different what i expected

https://code.sololearn.com/cO2uh9jBSQiW/?ref=app

15th Dec 2017, 9:10 AM
Indra Bhan Singh Patel
Indra Bhan Singh Patel - avatar
2 Answers
+ 2
I guess that the erratic behavior comes from the fact that your number you try to cast is too big to be stored as an integer. The program then outputs the biggest integer it knows.
15th Dec 2017, 9:31 AM
Corentin
Corentin - avatar
+ 1
Type Casting means - Converting one data type into another... - As an example, Pi = 3.1416 (it's in float or double data type) after type casting it into (integer), the output will be: Pi = 3 (only 3, cause we type casted it into integer) - Hope, you understood! 😊
15th Dec 2017, 9:15 AM
jamilxt
jamilxt - avatar