Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function coleyball(...input) {
- let year = input[0];
- let p = parseInt(input[1]);
- let h = parseInt(input[2]);
- let weekends = 48;
- let weekendsinSofia = weekends - h;
- let games = 0;
- // calcualting weekends in Sofia:
- games += weekendsinSofia * 3 / 4;
- // calculating weekends in the other town:
- games += h;
- // calcualting rest days
- games += 2 * p / 3;
- // calculating extra games in leap year:
- if (year === 'leap') {
- games *= 1.15;
- }
- console.log(`${Math.floor(games)}`)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement