desislava_topuzakova

06. Special Numbers начин 1

Nov 8th, 2020
2,124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.74 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class demo {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner (System.in);
  6.        int n = Integer.parseInt(scanner.nextLine());
  7.        //1111 -> 9999
  8.         for (int first = 1; first <= 9; first++) {
  9.             for (int second = 1; second <= 9; second++) {
  10.                 for (int third = 1; third <= 9; third++) {
  11.                     for (int forth = 1; forth <= 9; forth++) {
  12.                         if(n % first == 0 && n % second == 0 && n % third == 0 && n % forth == 0) {
  13.                             System.out.printf("%d%d%d%d ", first, second, third, forth);
  14.                         }
  15.                     }
  16.                 }
  17.             }
  18.         }
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment