Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class E02magicCombination {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int magic = Integer.parseInt(scanner.nextLine());
- int d1 = 0;
- int d2;
- int d3;
- int d4;
- int d5;
- int d6;
- while (d1 <= 9) {
- d2 = 0;
- d1++;
- while (d2 <= 9) {
- d3 = 0;
- d2++;
- while (d3 <= 9) {
- d4 = 0;
- d3++;
- while (d4 <= 9) {
- d5 = 0;
- d4++;
- while (d5 <= 9) {
- d6 = 0;
- d5++;
- while (d6 <= 9) {
- d6++;
- if (d1 * d2 * d3 * d4 * d5 * d6 == magic) {
- System.out.print(String.format("%d%d%d%d%d%d ", d1, d2, d3, d4, d5, d6));
- }
- }
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment