Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int n = Integer.parseInt(scanner.nextLine());
- for (int i = 1; i < 9; i++) {
- for (int j = 9; j > i; j--) {
- for (int k = 0; k < 9; k++) {
- for (int l = 9; l > k; l--) {
- if ((i + j + k + l) == i * j * k * l && n % 10 == 5) {
- System.out.printf("%d%d%d%d", i, j, k, l);
- System.exit(0);
- }
- if (i * j * k * l / (i + j + k + l) == 3 && n % 3 == 0) {
- System.out.printf("%d%d%d%d", l, k, j, i);
- System.exit(0);
- }
- }
- }
- }
- }
- System.out.println("Nothing found");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement