TZinovieva

Movie Tickets JS

Dec 4th, 2022
85
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function movieTickets(input) {
  2.     let a1 = Number(input[0]);
  3.     let a2 = Number(input[1]);
  4.     let n = Number(input[2]);
  5.  
  6.     let ticketNumber = "";
  7.     for ( let i = a1; i <= a2 - 1; i++) {
  8.         for (let j = 1; j <= n - 1; j++) {
  9.             for (let k = 1; k <= n / 2 - 1; k++) {
  10.            
  11.                 if (i % 2 !== 0 && (j + k + i) % 2 !== 0) {
  12.                 ticketNumber = `${String.fromCharCode(i)}-${j}${k}${i}`;
  13.                 console.log(ticketNumber);
  14.                 }
  15.             }  
  16.         }
  17.     }
  18. }
Advertisement
Comments
Add Comment
Please, Sign In to add comment