Why i get different 9 digit number while get output of 10 digit variable ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why i get different 9 digit number while get output of 10 digit variable ??

want good solution

5th Feb 2017, 6:06 PM
yuvi
2 Answers
0
If you are trying to output a 10 digit number and get a 9-digit number instead, your problem might be that you use int instead of long long int. Int's capacity is 2^32 (which results in bounds of about 2 billions positive and negative, which is just 10-digit, so you can't get 10-digit numbers above 2 billion), and long long int's capacity is 2^64, which gives bounds around 9 billions of billions positive and negative, which is 20-digit. Just specify "int" with two "long"s before it.
6th Feb 2017, 3:57 AM
DotJason
0
ohh....i undesrstand thsnk u frn...
6th Feb 2017, 6:33 AM
yuvi