Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class SpecialNumbers {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int hilqdni, stotici, edinici, desetici;
- int n = Integer.parseInt(scanner.nextLine());
- for (int i = 1111; i <= 9999; i++) {
- hilqdni = i / 1000;
- stotici = (i / 100) % 10;
- desetici = (i / 10) % 10;
- edinici = i % 10;
- if ((n % hilqdni == 0 && n % stotici == 0) && n % desetici == 0 && n % edinici == 0) {
- System.out.print(i + " ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement