Здравейте!
Имам проблем с 9-та задача от подготвителния курс за JavaScript - Types and Variables.
Задачата е следната:
You want to buy this really cool car from the UK, but you are worried about the fuel consumption. The values you see are MPG (miles per gallon). You have no idea what 20 MPG means so, being a programmer, decide to write a converter that helps you calculate the consumption.
Doing some research, you learn that 1 gallon = 4.54 litres
and 1 mile = 1.6 km
.
After the calculation, round the result down to the neareast whole number.
МОЕТО РЕШЕНИЕ:
let l_MPL = +gets();
let unknown_LKM = 100*4.54/l_MPL/1.66;
let rounded = Math.round(unknown_LKM);
print(${rounded} litres per 100 km
);
При тест във VSCode минава, но на онлайн платформата НЕ.
Какво изпускам?