Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function movieTickets(input) {
- let a1 = Number(input[0]);
- let a2 = Number(input[1]);
- let n = Number(input[2]);
- let ticketNumber = "";
- for ( let i = a1; i <= a2 - 1; i++) {
- for (let j = 1; j <= n - 1; j++) {
- for (let k = 1; k <= n / 2 - 1; k++) {
- if (i % 2 !== 0 && (j + k + i) % 2 !== 0) {
- ticketNumber = `${String.fromCharCode(i)}-${j}${k}${i}`;
- console.log(ticketNumber);
- }
- }
- }
- }
- }
Advertisement
Comments
-
- The String.fromCharCode() method converts Unicode values to characters.
Add Comment
Please, Sign In to add comment