4/5 test causes failed i don't no why he doesn't work | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

4/5 test causes failed i don't no why he doesn't work

import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner input = new Scanner(System.in); //your code goes here int houses = input.nextInt(); int result ; result = 100/(houses/2) ; System.out.println(result);

6th May 2020, 4:15 AM
Abduosh
Abduosh - avatar
5 Answers
6th May 2020, 4:31 AM
Tarun Kumar
Tarun Kumar - avatar
+ 2
Abduosh Language doesn't matter when logic is same. Check problem again. There is a condition houses >= 3. So you should check this condition like if (houses >= 3) { result = 200 / houses. } There is one more condition output should be nearest whole number so result= Math.ceil(result); Math.round(result);
6th May 2020, 4:57 AM
A͢J
A͢J - avatar
0
I am using java not c++
6th May 2020, 4:42 AM
Abduosh
Abduosh - avatar
0
Scanner input = new Scanner(System.in); double houses = input.nextDouble(); double chance = (2/houses)*100; System.out.println((int)Math.ceil(chance)); }
6th May 2020, 5:12 AM
Abduosh
Abduosh - avatar
0
I Solved the problems thanks
6th May 2020, 5:13 AM
Abduosh
Abduosh - avatar