Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function theSongOfTheWheels(input) {
- let number = Number(input[0]);
- let print = '';
- let password = 'No!';
- let counter = 0;
- for (let a = 1; a <= 9; a++) {
- for (let b = 1; b <= 9; b++) {
- for (let c = 1; c <= 9; c++) {
- for (let d = 1; d <= 9; d++) {
- if (a * b + c * d === number && a < b && c > d) {
- print += `${a}${b}${c}${d} `;
- counter++;
- if (counter === 4) {
- password = `Password: ${a}${b}${c}${d}`;
- }
- }
- }
- }
- }
- }
- console.log(`${print}\n${password}`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement