diff --git a/Calculators/ScientificCalculator/README.md b/Calculators/ScientificCalculator/README.md new file mode 100644 index 000000000..72f2b6cd7 --- /dev/null +++ b/Calculators/ScientificCalculator/README.md @@ -0,0 +1,26 @@ +# Scientific Calculator + +## Description +This project is a **Scientific Calculator** built using HTML, CSS, and JavaScript. It extends the basic calculator's functionality by incorporating advanced mathematical operations such as trigonometric functions (sin, cos, tan), logarithms, square root, exponentiation, and constants like π and e. + +The calculator is designed to handle basic arithmetic as well as more complex mathematical calculations typically used in science and engineering. + +## Features +- Basic Arithmetic Operations (Addition, Subtraction, Multiplication, Division) +- Percentage Calculation +- Trigonometric Functions (sin, cos, tan) +- Logarithmic Function (log) +- Exponentiation (^) +- Square Root (√) +- Constants (π and e) +- Clear and Delete (C and DEL) + +## Tech Stack +- **HTML**: For structuring the calculator layout and UI elements. +- **CSS**: For styling the calculator, making it visually appealing and responsive. +- **JavaScript**: For handling all the mathematical logic and interactive features of the calculator. + +## How to Use +1. Clone the repository using: + ```bash + git clone https://github.com//CalcDiverse.git diff --git a/Calculators/ScientificCalculator/index.html b/Calculators/ScientificCalculator/index.html new file mode 100644 index 000000000..db3964137 --- /dev/null +++ b/Calculators/ScientificCalculator/index.html @@ -0,0 +1,62 @@ + + + + + + + Scientific Calculator + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + \ No newline at end of file diff --git a/Calculators/ScientificCalculator/script.js b/Calculators/ScientificCalculator/script.js new file mode 100644 index 000000000..a2f27b7dd --- /dev/null +++ b/Calculators/ScientificCalculator/script.js @@ -0,0 +1,37 @@ +let screen = document.getElementById('screen'); + +// Appending numbers +function appendNumber(number) { + screen.value += number; +} + +// Appending operators +function appendOperator(operator) { + screen.value += operator; +} + +// Appending functions like sin, cos, tan +function appendFunction(func) { + screen.value += func; +} + +// Clearing the screen +function clearScreen() { + screen.value = ''; +} + +// Deleting last character +function deleteLast() { + screen.value = screen.value.slice(0, -1); +} + +// Calculating the result +function calculate() { + try { + screen.value = eval(screen.value); + } catch (error) { + console.log(error) + alert('Invalid input'); + screen.value = ''; + } +} diff --git a/Calculators/ScientificCalculator/style.css b/Calculators/ScientificCalculator/style.css new file mode 100644 index 000000000..6616d581e --- /dev/null +++ b/Calculators/ScientificCalculator/style.css @@ -0,0 +1,57 @@ +body { + font-family: 'Arial', sans-serif; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + background-color: #f4f4f4; +} + +.calculator { + width: 400px; + background-color: #ffffff; + border-radius: 10px; + box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.2); +} + +.calculator-screen { + width: 100%; + height: 80px; + border: none; + background-color: #252525; + color: white; + text-align: right; + padding: 20px; + font-size: 2.5rem; + border-radius: 10px 10px 0 0; +} + +.calculator-keys { + display: grid; + grid-template-columns: repeat(4, 1fr); + grid-gap: 10px; + padding: 20px; +} + +.btn { + height: 60px; + font-size: 1.5rem; + background-color: #e0e0e0; + border: none; + border-radius: 5px; + transition: background-color 0.3s ease; +} + +.btn:hover { + background-color: #d4d4d4; +} + +.equal-sign { + grid-column: span 4; + background-color: #f57c00; + color: white; +} + +.equal-sign:hover { + background-color: #e57300; +} diff --git a/index.html b/index.html index ae6fdb43f..725462060 100644 --- a/index.html +++ b/index.html @@ -5802,6 +5802,22 @@

Calculates the Critical point of ideal gases based on a and b

+ +
+
+

Scientific Calculator

+

Converts various trigonometric calculation./h3> + +

+
+




No results found 🙃