Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class TheSongOfTheWheels {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int n = Integer.parseInt(scanner.nextLine()),
- counter = 0;
- String print = "No!";
- for (int a = 1; a <= 9; a++) {
- for (int b = 1; b <= 9; b++) {
- for (int c = 1; c <= 9; c++) {
- for (int d = 1; d <= 9; d++) {
- if (a * b + c * d == n && a < b && c > d) {
- System.out.printf("%d%d%d%d ", a, b, c, d);
- counter++;
- if (counter == 4) {
- print = "Password: " + a + b + c + d;
- }
- }
- }
- }
- }
- }
- System.out.printf("\n%s", print.trim());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement