I cannot figure out why my if-else statements are not working properly. This is what I have so far:
import java.util.Scanner;
public class multiple {
public static void main (String[] args){
Scanner input = new Scanner (System.in);
int x = 4;
int y = 3;
int multiple = y % x;
while (multiple != 0){
System.out.println("Enter two integers: ");
x = input.nextInt();
y = input.nextInt();
if (multiple != 0)
System.out.println("Oops, sorry! The second integer is NOT a multiple of the first integer.");
else
System.out.println("Good Job! " + y + " is a multiple of " + x + "!");
}
}
}
Aucun commentaire:
Enregistrer un commentaire