Advertisement
Spocoman

05. Challenge the Wedding

Jan 1st, 2022 (edited)
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function challengeTheWedding(input) {
  2.     let maleNumber = Number(input[0]);
  3.     let femaleNumber = Number(input[1]);
  4.     let tableNumber = Number(input[2]);
  5.     let print = '';
  6.  
  7.     for (let i = 1; i <= maleNumber; i++) {
  8.         for (let k = 1; k <= femaleNumber; k++) {
  9.             if (tableNumber === 0) {
  10.                 break;
  11.             }
  12.             print += `(${ i} <-> ${ k}) `;
  13.             tableNumber--;
  14.         }
  15.     }
  16.     console.log(print);
  17. }
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement