Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function barcode(arr, marr) {
- let start = Number(arr);
- let end = Number(marr);
- start_first = Number(Math.floor(start / 1000));
- start_second = Number(Math.floor((start / 100) % 10));
- start_third = Number(Math.floor((start / 10) % 10));
- start_fourth = Number(Math.floor(start % 10));
- end_first = Number(Math.floor(end / 1000));
- end_second = Number((Math.floor(end / 1000) % 10));
- end_third = Number((Math.floor(end / 10) % 10));
- end_fourth = Number(Math.floor(end % 10));
- for (let num_1 = start_first; num_1 <= end_first; num_1++) {
- for (let num_2 = start_second; num_2 <= end_second; num_2++) {
- for (let num_3 = start_third; num_3 <= end_third; num_3++) {
- for (let num_4 = start_fourth; num_4 <= end_fourth; num_4++) {
- if (num_1 % 2 !== 0 && num_2 % 2 !== 0 && num_3 % 2 !== 0 && num_4 % 2 !== 0) {
- console.log(`${num_1}${num_2}${num_3}${num_4}`);
- }
- }
- }
- }
- }
- }
- barcode(2345,
- 6789);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement