Fun Scientific Calculator
About this app
A colorful and interactive scientific calculator app featuring various mathematical functions, making calculations easy and enjoyable.
Fun Scientific Calculator Scientific Calculator 7 8 9 ∕ 4 5 6 ✕ 1 2 3 - 0 C π + =
Related apps
Put this on your site
Source
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Fun Scientific Calculator</title>
<meta name="description" content="A colorful and interactive scientific calculator app featuring various mathematical functions, making calculations easy and enjoyable.">
<meta name="keywords" content="Calculator, Scientific Calculator, Math, Functions, Online Tools, Interactive, Fun, Educational">
<!-- Libraries -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.min.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.6.0/css/fontawesome.min.css" crossorigin="anonymous">
<script type="text/javascript">
try {
document.addEventListener("DOMContentLoaded", function() {
let currentInput = "";
let display = document.getElementById("display");
function appendNumber(number) {
currentInput += number;
updateDisplay();
}
function updateDisplay() {
display.value = currentInput;
}
function clearInput() {
currentInput = "";
updateDisplay();
}
function calculateResult() {
try {
currentInput = eval(currentInput);
updateDisplay();
} catch (error) {
display.value = "Error";
}
}
function handleButtonClick(e) {
const value = e.target.dataset.value;
if (value === "=") {
calculateResult();
} else if (value === "C") {
clearInput();
} else {
appendNumber(value);
}
}
document.querySelectorAll(".btn").forEach(button => {
button.addEventListener("click", handleButtonClick);
});
});
} catch (error) {
throw error;
}
</script>
<style>
body {
background: linear-gradient(to right, #74ebd5, #acb6e5);
color: #333;
}
#main-container {
margin-top: 100px;
text-align: center;
}
.button-panel {
display: grid;
grid-template-columns: repeat(4, 80px);
gap: 10px;
}
textarea {
width: 320px;
height: 60px;
font-size: 24px;
text-align: right;
margin-bottom: 20px;
border: 2px solid #acb6e5;
border-radius: 5px;
padding: 10px;
background: #fff;
}
.btn {
padding: 20px;
font-size: 20px;
border-radius: 5px;
cursor: pointer;
transition: transform 0.1s;
}
.btn:hover {
transform: scale(1.05);
}
.btn-primary {
background-color: #4caf50;
border: none;
color: white;
}
.btn-danger {
background-color: #f44336;
border: none;
color: white;
}
.btn-info {
background-color: #2196F3;
border: none;
color: white;
}
.btn-secondary {
background-color: #9e9e9e;
border: none;
color: white;
}
</style>
</head>
<body>
<div id="main-container" class="container">
<h1>Scientific Calculator</h1>
<textarea id="display" readonly></textarea>
<div class="button-panel">
<button class="btn btn-secondary" data-value="7">7</button>
<button class="btn btn-secondary" data-value="8">8</button>
<button class="btn btn-secondary" data-value="9">9</button>
<button class="btn btn-danger" data-value="/">∕</button>
<button class="btn btn-secondary" data-value="4">4</button>
<button class="btn btn-secondary" data-value="5">5</button>
<button class="btn btn-secondary" data-value="6">6</button>
<button class="btn btn-danger" data-value="*">✕</button>
<button class="btn btn-secondary" data-value="1">1</button>
<button class="btn btn-secondary" data-value="2">2</button>
<button class="btn btn-secondary" data-value="3">3</button>
<button class="btn btn-danger" data-value="-">-</button>
<button class="btn btn-secondary" data-value="0">0</button>
<button class="btn btn-info" data-value="C">C</button>
<button class="btn btn-warning" data-value="pi">π</button>
<button class="btn btn-danger" data-value="+">+</button>
<button class="btn btn-primary" data-value="=">=</button>
</div>
</div>
</body>
</html>
NEW APPS
These are apps made by the community!