Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function vetParking(input) {
- let day = Number(input[0]);
- let hour = Number(input[1]);
- let total = 0;
- for (let i = 1; i <= day; i++) {
- let sum = 0;
- for (let j = 1; j <= hour; j++) {
- if (i % 2 === 1) {
- if (j % 2 === 1) {
- sum += 1;
- } else {
- sum += 1.25;
- }
- } else {
- if (j % 2 === 1) {
- sum += 2.5;
- } else {
- sum += 1;
- }
- }
- }
- console.log(`Day: ${i} - ${sum.toFixed(2)} leva`);
- total += sum;
- }
- console.log(`Total: ${total.toFixed(2)} leva`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement