Discover the answers you need at Westonci.ca, where experts provide clear and concise information on various topics. Ask your questions and receive detailed answers from professionals with extensive experience in various fields. Join our Q&A platform to connect with experts dedicated to providing accurate answers to your questions in various fields.
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();
}
}
We hope you found this helpful. Feel free to come back anytime for more accurate answers and updated information. Thank you for visiting. Our goal is to provide the most accurate answers for all your informational needs. Come back soon. Thank you for visiting Westonci.ca, your go-to source for reliable answers. Come back soon for more expert insights.