Advertisement
desislava_topuzakova

SpecialNumbers

Oct 27th, 2017
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class SpecialNumbers {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int hilqdni, stotici, edinici, desetici;
  7.         int n = Integer.parseInt(scanner.nextLine());
  8.         for (int i = 1111; i <= 9999; i++) {
  9.             hilqdni = i / 1000;
  10.             stotici = (i / 100) % 10;
  11.             desetici = (i / 10) % 10;
  12.             edinici = i % 10;
  13.             if ((n % hilqdni == 0 && n % stotici == 0) && n % desetici == 0 && n % edinici == 0) {
  14.                 System.out.print(i + " ");
  15.  
  16.             }
  17.         }
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement