0

I pass all except the third parameter and don't know why, anyone please help..?

https://code.sololearn.com/cVEf6S7mGeZl/?ref=app

19th Oct 2020, 4:14 PM
Sean
Sean - avatar
2 Antworten
0
import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner input = new Scanner(System.in); int siblings = input.nextInt(); int popsicles = input.nextInt(); if(popsicles %siblings==0) System.out.println("give away"); else System.out.println("eat them yourself"); } }
19th Oct 2020, 4:51 PM
Vishakha Shrivastav
Vishakha Shrivastav - avatar
0
Read this line from that question: "if you have enough left in the box to give them each an even amount you should go for it! If not, they will fight over them, and you should eat them yourself later" But you are checking weather sibling and popsicles divide by 2 which doesn't give a valid answer . You should check if popsicles are successfully divide by the siblings .
19th Oct 2020, 4:47 PM
The future is now thanks to science
The future is now thanks to science - avatar