Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2019
673
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class ForSpecialNumbers {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. int n =Integer.parseInt(scanner.nextLine());
  8.  
  9. for (int first = 1; first <=9 ; first++) {
  10. for (int second = 1; second <=9 ; second++) {
  11. for (int third = 1; third <=9 ; third++) {
  12. for (int four = 1; four <=9 ; four++) {
  13. boolean check1= n % first == 0;
  14. boolean check2= n % second == 0;
  15. boolean check3= n % third == 0;
  16. boolean check4= n % four == 0;
  17.  
  18. if (check1 && check2 && check3 && check4){
  19. System.out.printf("%d%d%d%d ",first,second,third,four);
  20. }
  21. }
  22.  
  23. }
  24.  
  25. }
  26.  
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement