Weight Loss Calculator body { font-family: Arial, sans-serif; } h1 { color: #333; text-align: center; } form { max-width: 400px; margin: 0 auto; text-align: center; } input[type="number"] { width: 60%; padding: 12px 20px; margin: 8px 0; box-sizing: border-box; border: 1px solid #ccc; border-radius: 4px; } input[type="radio"] { margin: 0 8px; } label { color: #333; font-weight: bold; } button { width: 40%; background-color: #4CAF50; color: white; padding: 14px 20px; margin: 8px 0; border: none; border-radius: 4px; cursor: pointer; } #result { margin: 16px 0; font-size: 18px; font-weight: bold; } Weight Loss Calculator Enter your current weight: kg lb Calculate function calculateWeightLoss() { // Get the weight input and selected unit var weightInput = document.getElementById("weightInput").value; var weightUnit = document.querySelector('input[name="weightUnit"]:checked').value; // Convert pounds to kilograms if (weightUnit === "lb") { weightInput = weightInput / 2.20462; } // Calculate the weight loss var weightLoss = weightInput * 0.2; // Update the result text document.getElementById("result").innerHTML = "Your recommended weight loss is " + weightLoss + " kg."; }