SCIENTIFIC CALCULATOR

<div id="calculator">
    <input type="text" id="display" disabled>
    <br>
    <!-- Include your calculator buttons here -->
</div>

<script>
    function appendToDisplay(value) {
        document.getElementById('display').value += value;
    }

    function clearDisplay() {
        document.getElementById('display').value = '';
    }

    function calculate() {
        try {
            document.getElementById('display').value = eval(document.getElementById('display').value);
        } catch (error) {
            document.getElementById('display').value = 'Error';
        }
    }

    function backspace() {
        var display = document.getElementById('display');
        display.value = display.value.slice(0, -1);
    }
</script>

Leave a Reply

Your email address will not be published. Required fields are marked *