Advertisement
chono55

SpecNum

Jun 23rd, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.14 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class SpecialnumbersBoolean {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         int N = Integer.parseInt(scanner.nextLine());
  8.  
  9.         for(int i = 1; i <= 9;i++){
  10.             if(N%i != 0){
  11.                continue;
  12.             }
  13.             for(int o = 1;o <= 9;o++){
  14.                 if(N%o != 0){
  15.                     continue;
  16.                 }
  17.                 for(int p = 1;p <= 9;p++){
  18.                     if(N%p != 0){
  19.                         continue;
  20.                     }
  21.                     for (int a = 1; a <= 9;a++){
  22.                         if(N%a != 0){
  23.                             continue;
  24.                         }
  25.                         boolean f1 = (N%i == 0);
  26.                         boolean f2 = (N%o == 0);
  27.                         boolean f3 = (N%p == 0);
  28.                         boolean f4 = (N%a == 0);
  29.  
  30.                         if(f1 && f2 && f3 && f4){
  31.  
  32.                             System.out.printf("%d%d%d%d ",i,o,p,a);
  33.                         }
  34.                     }
  35.                 }
  36.             }
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement