what's the difference between double and int? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what's the difference between double and int?

5th Nov 2016, 1:06 PM
Ziyaan Hassan
Ziyaan Hassan - avatar
3 Answers
+ 2
double means it will contains float number like 1.5,65.76 and -66.99 etc it has 64 bit size int is contains integers like 1,4,3 etc it has 32 bit size
5th Nov 2016, 1:16 PM
Aditya kumar pandey
Aditya kumar pandey - avatar
+ 2
An int (integer) can only be a full numerical variable which has no decimal place, while double is a numerical variable that allows you to input numbers with decimal places. E.g. int x = 3; //full number double y = 3.3; // not a full numbers contains decimal place
5th Nov 2016, 1:51 PM
Abdelaziz Abubaker
Abdelaziz Abubaker - avatar
+ 2
double has decimals while int does not, also int operations get automatically rounded (down) if you don't place the result into a double variable
5th Nov 2016, 10:01 PM
Eduard Alexandru
Eduard Alexandru - avatar