will addition of integers also give me a float value? Eg. 2 + 3 = 5.0 or 2 + 3 = 5 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

will addition of integers also give me a float value? Eg. 2 + 3 = 5.0 or 2 + 3 = 5

15th Jan 2017, 7:18 AM
Quinn
Quinn - avatar
2 Answers
+ 5
No, addition, subtraction and even multiplication will give you INTEGER when you will perform math operations with integers But division will give FLOAT values always
15th Jan 2017, 7:21 AM
WittyBit
WittyBit - avatar
+ 5
int + int = int float + int = float division = float float + float = float int * float = float int * int = int float * float = float
15th Jan 2017, 8:09 AM
Kawaii
Kawaii - avatar