Advertisement
Lyubohd

Special Numbers

Nov 25th, 2019
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.64 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class SpecialNumbers {
  4.     public static void main(String[] args) {
  5.         Scanner scan = new Scanner(System.in);
  6.  
  7.         int n = Integer.parseInt(scan.nextLine());
  8.  
  9.         for (int i = 1; i <= 9; i++) {
  10.             for (int j = 1; j <= 9; j++) {
  11.                 for (int k = 1; k <= 9; k++) {
  12.                     for (int l = 1; l <= 9; l++) {
  13.                         if (n % i == 0 && n % j == 0 && n % k == 0 && n % l == 0) {
  14.                             System.out.printf("%d%d%d%d ", i, j, k, l);
  15.                         }
  16.                     }
  17.                 }
  18.             }
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement