0
Help with halloween candy on code coach?
I was trying to solve the halloween candy problem on code coach with Java. I got stuck at a point where I was asked to round my result to the nearest integer. Can someone please explain the solution to me?
3 Respuestas
+ 4
Import the math module at the top of your program like this
import java.lang.Math.*;
Then use this in the result
System.out.println(Math.ceil(result));
+ 1
You don't need to import it, it's already there just use Math.round
+ 1
Ankit is right you do not have to import math, but you should use ceil function because in the question specified rounding it up