<script>
const carWeight = prompt("Укажите вес авто в кг");
const carPower = prompt("Укажите мощность авто в л.с.");
const conclusion = getPowerConclusion(carWeight, carPower);
console.log(conclusion);
function getPowerIndex(weight, height) {
return carPower/((carWeight/1000)**2);
}
function getPowerConclusion (weight, height) {
const index = getPowerIndex(weight, height)
if(index >= 1 && index <= 20) {
alert("У вас Старый Корч");
}
else if(index >= 21 && index <= 30) {
alert("У вас Тарантас");
}
else if(index >= 31 && index <= 40) {
alert("У вас Старый Таз");
}
else if(index >= 41 && index <= 50) {
alert("У вас Легковушка");
}
else if(index >= 51 && index <= 60) {
alert("У вас Норм Тачка");
}
else if(index >= 61 && index <= 70) {
alert("У вас похоже крузак ");
}
else if(index >= 71 && index <= 80) {
alert("У вас Грузовой Тягач");
}
else if(index >= 81 && index <= 90) {
alert("У вас Космический корабль");
}
else {
alert("Не ври мне. таких двигателей нет в природе")
}
}