Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
0
A simple example: double d = 1/2; d is now 0 Why? 1 and 2 are Integer, therefore Integer division is executed which results in 0 Fix the problem: double d = (double)1/2 This way d is 0.5 As the first operand is double, a double division is executed.
29th May 2020, 7:39 PM
Michi
Michi - avatar