You are dividing an int by int; the result is an integer. You must cast one of the int to the double data type to get the correct result.
Sum = (double)n/d;
solved [Java]- What is wrong with this code? [closed]
You are dividing an int by int; the result is an integer. You must cast one of the int to the double data type to get the correct result.
Sum = (double)n/d;
solved [Java]- What is wrong with this code? [closed]