galinyotsev123

ProgBasicsJavaBook7.2ComplexLoop04specialNumbers

Jan 12th, 2019
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class E04specialNumbers {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7.  
  8. int n = Integer.parseInt(scanner.nextLine());
  9. int rest = 10;
  10.  
  11. for (int i = 1; i < rest; i++) {
  12. for (int j = 1; j < rest; j++) {
  13. for (int k = 1; k < rest; k++) {
  14. for (int l = 1; l < rest; l++) {
  15.  
  16. if ((n % i == 0) && (n % j == 0) && (n % k == 0) && (n % l == 0)) {
  17. System.out.printf("%d%d%d%d ", i, j, k, l);
  18.  
  19. }
  20.  
  21.  
  22. }
  23. }
  24. }
  25. }
  26.  
  27.  
  28.  
  29. }
  30. }
Add Comment
Please, Sign In to add comment