0

# Halloween candy

double remainder = houses/2; int perc = Math.round(100/remainder); System.out.println(perc); That the java code I tried but it ain't working. Could any one help?

3 Antworten

+ 4

Solomon Debesai did you overlook the requirement to round up? The Math.ceil() function comes in handy for that.

+ 1

I solved the challenge
Thank you so much guys for your help

0

Math.round() returns long not an int.
change the type of the variable to long or just use typecasting.
int perc = (int) Math.round(100/remainder);