Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class Dance {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int n = Integer.parseInt(scanner.nextLine());
- for (int first = 1; first <= 9 ; first++) {
- for (int second = 1; second <= 9 ; second++) {
- for (int third = 1; third <= 9 ; third++) {
- for (int four = 1; four <= 9; four++) {
- boolean n1 = n % first == 0;
- boolean n2 = n % second == 0;
- boolean n3 = n % third == 0;
- boolean n4 = n % four == 0;
- if (n1 && n2 && n3 && n4) {
- System.out.printf("%d%d%d%d ", first, second, third, four);
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement