Advertisement
CoineTre

06. Special Numbers Nested Loops Solution

Dec 1st, 2020
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class SpecialNumbersNestedLoops {
  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 i = 1; i < 9; i++) {
  9.             for (int j = 1; j < 9; j++) {
  10.                 for (int k = 1; k <9; k++) {
  11.                     for (int l = 1; l <9; l++) {
  12.                         if (n%i==0 && n % j == 0 && n%k==0 && n%l ==0)
  13.                         System.out.printf("%d%d%d%d ",i,j,k,l);
  14.                     }
  15.                 }
  16.             }
  17.         }
  18.     }
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement