Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Uprajneniq;
- import java.util.Scanner;
- /**
- * Created by todor on 21.02.2017 г..
- */
- public class u16_MagicNumbers {// doMagic :)
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int magicNumber = Integer.parseInt(scan.nextLine());
- for (int i = 111111; i < 1000000; i++) {
- int currentIndex = i;
- int result = 1;
- while (currentIndex > 0){
- result *= currentIndex % 10;
- currentIndex /= 10;
- }
- if (result == magicNumber) {
- System.out.printf("%d ", i);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement