Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function barcodeGenerator(input) {
- let startNum = Number(input[0]);
- let finalNum = Number(input[1]);
- let output = '';
- for (let a = Math.floor(startNum / 1000); a <= Math.floor(finalNum / 1000); a++) {
- for (let b = Math.floor(startNum / 100) % 10; b <= Math.floor(finalNum / 100) % 10; b++) {
- for (let c = Math.floor(startNum / 10) % 10; c <= Math.floor(finalNum / 10) % 10; c++) {
- for (let d = startNum % 10; d <= finalNum % 10; d++) {
- if (a % 2 === 1 && b % 2 === 1 && c % 2 === 1 && d % 2 === 1) {
- output += `${a}${b}${c}${d} `;
- }
- }
- }
- }
- }
- console.log(output);
- }
- ИЛИ:
- function barcodeGenerator(input) {
- let startNum = input[0];
- let finalNum = input[1];
- let output = '';
- for (let a = startNum[0]; a <= finalNum[0]; a++) {
- for (let b = startNum[1]; b <= finalNum[1]; b++) {
- for (let c = startNum[2]; c <= finalNum[2]; c++) {
- for (let d = startNum[3]; d <= finalNum[3]; d++) {
- if (a % 2 === 1 && b % 2 === 1 && c % 2 === 1 && d % 2 === 1) {
- output += `${a}${b}${c}${d} `;
- }
- }
- }
- }
- }
- console.log(output);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement