Advertisement
MeGaM1nd

Untitled

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