desislava_topuzakova

02. Division

Jan 15th, 2021
899
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Division_02 {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int number = Integer.parseInt(scanner.nextLine());
  7.         //2, 3, 6, 7, 10
  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