ChatGPT Develops Calculator Using HTML, CSS, and JavaScript #shorts

Posted by

ChatGPT Calculator

body {
font-family: Arial, sans-serif;
text-align: center;
padding-top: 50px;
}
.calculator {
display: flex;
flex-direction: column;
align-items: center;
width: 300px;
margin: 0 auto;
}
input[type=”button”] {
width: 50px;
height: 50px;
margin: 5px;
}
input[type=”text”] {
width: 100%;
height: 50px;
margin-bottom: 10px;
text-align: right;
font-size: 24px;
}

ChatGPT Calculator

function appendToDisplay(value) {
document.getElementById(‘display’).value += value;
}
function clearDisplay() {
document.getElementById(‘display’).value = ”;
}
function calculate() {
let expression = document.getElementById(‘display’).value;
let result = eval(expression);
document.getElementById(‘display’).value = result;
}

0 0 votes
Article Rating
2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
@codeandcreate
11 months ago
@elmojon2720
11 months ago

Wow