Advertisement
Guest User

MagicNumbers

a guest
Feb 22nd, 2017
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.09 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. /**
  4.  * Created by Jo odigit12/22/2017.
  5.  */
  6. public class MagicNumbers {
  7.     public static void main(String[] args) {
  8.         Scanner console = new Scanner(System.in);
  9.         int number = Integer.parseInt(console.nextLine());
  10.         int digit;
  11.  
  12.         for (int digit6 = 1; digit6 <= 9; digit6++) {
  13.             for (int digit5 = 1; digit5 <= 9; digit5++) {
  14.                 for (int digit4 = 1; digit4 <= 9; digit4++) {
  15.                     for (int digit3 = 1; digit3 <= 9; digit3++) {
  16.                         for (int digit2 = 1; digit2 <= 9; digit2++) {
  17.                             for (int digit1 = 1; digit1 <= 9; digit1++) {
  18.                                 digit = digit1 * digit2 * digit3 * digit4 * digit5 * digit6;
  19.                                 if (number == digit) {
  20.                                     System.out.printf("%d%d%d%d%d%d ", digit6, digit5, digit4, digit3, digit2, digit1);
  21.                                 }
  22.                             }
  23.                         }
  24.                     }
  25.                 }
  26.             }
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement