Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Y11specialNumbers {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int n = Integer.parseInt(sc.nextLine());
- int resto = 0;
- for (int i = 1111; i <= 9999; i++) { // DCBA
- int a = i % 10;
- resto = i / 10; // DCB
- int b = resto % 10;
- resto = resto / 10; // DC
- int c = resto % 10;
- resto = resto / 10; //D
- int d = resto;
- if (a != 0 && b != 0 && c != 0 ) { // prowerqwame dali
- // sa razlichni ot nula , D nqma kak da e nula, zashotot chislata sa 4 cifreni
- if (n % a == 0 && n % b == 0 && n % c == 0 && n % d == 0) { // prowerka che se
- // deli bez ostatyk N na vsqka cifra
- System.out.print(d + "" + c + "" + b + "" + a + " ");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment