At Westonci.ca, we provide reliable answers to your questions from a community of experts. Start exploring today! Join our platform to get reliable answers to your questions from a knowledgeable community of experts. Get detailed and accurate answers to your questions from a dedicated community of experts on our Q&A platform.
Sagot :
Answer:
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
while(true) {
System.out.print("Enter an integer (0 to exit): ");
int num = scan.nextInt();
if (num == 0) break;
if (num%3 == 0 && num%5 == 0) {
System.out.printf("%d is divisable by both 3 and 5.\n", num);
}
else if (num%3 == 0 && num%5 != 0) {
System.out.printf("%d is divisable by 3 but not by 5.\n", num);
}
else if (num%3 != 0 && num%5 == 0) {
System.out.printf("%d is divisable by 5 but not by 3.\n", num);
} else {
System.out.printf("%d is not divisable by 3 or 5.\n", num);
}
}
scan.close();
}
}
Your visit means a lot to us. Don't hesitate to return for more reliable answers to any questions you may have. We hope this was helpful. Please come back whenever you need more information or answers to your queries. We're glad you chose Westonci.ca. Revisit us for updated answers from our knowledgeable team.