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?

2nd Oct 2024, 8:31 PM
Solomon Debesai
Solomon Debesai - avatar
3 Antworten
+ 4
Solomon Debesai did you overlook the requirement to round up? The Math.ceil() function comes in handy for that.
2nd Oct 2024, 9:51 PM
Brian
Brian - avatar
+ 1
I solved the challenge Thank you so much guys for your help
3rd Oct 2024, 9:07 PM
Solomon Debesai
Solomon Debesai - avatar
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);
3rd Oct 2024, 10:29 AM
public static void