<div class="calculator-container">
    <h2>Compound Interest</h2>
    <div class="input-group"><label>Principal ($):</label><input type="number" id="principal"></div>
    <div class="input-group"><label>Rate (%):</label><input type="number" id="rate"></div>
    <div class="input-group"><label>Times Compounded:</label><input type="number" id="times"></div>
    <div class="input-group"><label>Years:</label><input type="number" id="years"></div>
    <button onclick="calculateCompound()">Calculate</button>
    <div class="result"><p>Total: $<span id="total">0.00</span></p></div>
</div>
<script>
    function calculateCompound() {
        const p = parseFloat(document.getElementById('principal').value) || 0;
        const r = parseFloat(document.getElementById('rate').value) || 0;
        const n = parseInt(document.getElementById('times').value) || 1;
        const t = parseInt(document.getElementById('years').value) || 0;
        const total = p * Math.pow(1 + (r/100/n), n*t);
        document.getElementById('total').textContent = total.toFixed(2);
    }
</script>