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