0
Whats wrong with my code? Test 3 is the only one who failed
Popsicles
4 Respostas
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();
//your code goes here
if(siblings %2==0 && popsicles %2==0){
System.out.println("give away");
}
else{
System.out.println("eat them yourself");
}
}
}
here is my code
0
Both integers siblings and popsicles being divisible by 2 doesnt mean that popsicles % siblings == 0.
0
Example:
Popsicles = 12
Siblings = 8
Both are divisible by 2 but cannot be divided without a remainder.
Change your condition in the if - else statement.
0
Thanks