Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package BasicSyntaxCondLoops_Exercise;
- import java.util.Scanner;
- public class Division_02 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int number = Integer.parseInt(scanner.nextLine());
- //2, 3, 6, 7, 10
- //10
- if (number % 10 == 0) {
- System.out.println("The number is divisible by 10");
- }
- //7
- else if (number % 7 == 0) {
- System.out.println("The number is divisible by 7");
- }
- //6
- else if (number % 6 == 0) {
- System.out.println("The number is divisible by 6");
- }
- //3
- else if (number % 3 == 0) {
- System.out.println("The number is divisible by 3");
- }
- //2
- else if (number % 2 == 0) {
- System.out.println("The number is divisible by 2");
- }
- else {
- System.out.println("Not divisible");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment