Didart

Division

Sep 17th, 2021
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1. package src;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Division {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         int number = Integer.parseInt(scanner.nextLine());
  10.  
  11.         if (number % 10 == 0) {
  12.             System.out.println("The number is divisible by 10");
  13.         } else if (number % 7 == 0) {
  14.             System.out.println("The number is divisible by 7");
  15.         } else if (number % 6 == 0) {
  16.             System.out.println("The number is divisible by 6");
  17.         } else if (number % 3 == 0) {
  18.             System.out.println("The number is divisible by 3");
  19.         } else if (number % 2 == 0) {
  20.             System.out.println("The number is divisible by 2");
  21.         } else {
  22.             System.out.println("Not divisible");
  23.         }
  24.     }
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment