Advertisement
marking2112

Division

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