Integer division removes any remainder to result as an integer.....i dint understand this line | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Integer division removes any remainder to result as an integer.....i dint understand this line

16th May 2020, 6:42 AM
Radhika
Radhika - avatar
1 Answer
+ 3
Which language? If it's C , C++ or Java : result of integer / integer is always an integer. for example, 5/2 should be 2.5 but both the operands (5 and 2) are integers so result is also integer. Therefore number 2.5 is truncated to 2 and the result is 2 not 2.5 If either operand is float or double another operand will be promoted to be float or double and then result will be float or double. for example , 5.0 / 2 results in 2.5 (double value)
16th May 2020, 6:59 AM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar