desislava_topuzakova

Untitled

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