Which datatype is used for storing 10 digit of number ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Which datatype is used for storing 10 digit of number ?

int a = 500 // Compiling... :- No error int b = 6282828181 // Compiling... :- error How to resolve this problem ?

17th Mar 2018, 11:06 AM
Hemant Jaiswal
Hemant Jaiswal - avatar
4 Answers
+ 9
long int b = 6282828181; Assuming you are talking about C/C++ https://www.tutorialspoint.com/cplusplus/cpp_modifier_types.htm
17th Mar 2018, 11:10 AM
Hatsy Rei
Hatsy Rei - avatar
+ 3
In Java and C/C++, you can use long data type. For example, long num = 7992838929;
17th Mar 2018, 4:06 PM
Aaron Stone
Aaron Stone - avatar
+ 2
if you need numbers above what long can store (64bits) then take a look at BigIntegers, pretty much every language has a class like this which support numbers up to 2^(2^31-1) and can work for higher ones too
17th Mar 2018, 12:55 PM
Jeremy
Jeremy - avatar
+ 2
Thanks guys
17th Mar 2018, 2:38 PM
Hemant Jaiswal
Hemant Jaiswal - avatar