0

cant solve Hallowen candy What is the problem

import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner input = new Scanner(System.in); int hou = input.nextInt(); double dol = 2.0; double P = Math.round((dol / hou) * 100); if(hou >= 3) { System.out.println((int) P); } } }

23rd Dec 2021, 6:47 PM
Nathnael Dagnaw
Nathnael Dagnaw - avatar
2 Antworten
+ 3
Always print, not on if >= 3. Also, please read the task description carefully: It asks us to round ***up***
23rd Dec 2021, 7:06 PM
Lisa
Lisa - avatar
0
Thanks that worked
23rd Dec 2021, 7:28 PM
Nathnael Dagnaw
Nathnael Dagnaw - avatar