Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified Basic Calculator and Multiplication Table Calculator #577

Merged
merged 5 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Calculators/Basic-Calculator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Description :-

This calculator will help you calculate your basic arithmetic calculations. This is your user friendly basic old school calculator.
This calculator will help you calculate your basic arithmetic calculations. This is your user friendly basic calculator. It has added functionality of switching between dark and light mode. It has a modern design with a simple and easy to use interface.

## Tech Stack :-

Expand All @@ -11,4 +11,7 @@ This calculator will help you calculate your basic arithmetic calculations. This
- JavaScript

## Screenshot :-
![image](https://github.com/Rakesh9100/CalcDiverse/assets/134225415/840879ac-0dab-4977-828c-a48eff70d5a3)
### Dark Mode:
![Calculator-Demo-Image-Dark](image.png) <br><br>
### Light Mode:
![Calculator-Demo-Image-Light](image-1.png)
Binary file removed Calculators/Basic-Calculator/delete.png
Binary file not shown.
Binary file added Calculators/Basic-Calculator/image-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Calculators/Basic-Calculator/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 0 additions & 59 deletions Calculators/Basic-Calculator/index.html

This file was deleted.

79 changes: 79 additions & 0 deletions Calculators/Basic-Calculator/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Calculator In CSS</title>
<link rel="stylesheet" href="style.css">
</head>

<body>
<div class="btn">
<strong>🌞</strong>
<strong>🌙</strong>
</div>

<div class="container">
<form class="calculator" name="calc">

<input type="text" class="value" readonly name="txt">

<span class="num" onclick="calc.txt.value += '(' "><i>(</i></span>
<span class="num" onclick="calc.txt.value += ')' "><i>)</i></span>
<span class="num" onclick="calc.txt.value += '/' "><i>/</i></span>
<span class="num" onclick="calc.txt.value += '*' "><i>*</i></span>
<span class="num clear" onclick="calc.txt.value = '' "><i>C</i></span>

<span class="num" onclick="calc.txt.value += '7' "><i>7</i></span>
<span class="num" onclick="calc.txt.value += '8' "><i>8</i></span>
<span class="num" onclick="calc.txt.value += '9' "><i>9</i></span>
<span class="num" onclick="calc.txt.value += '+' "><i>+</i></span>
<span class="num" onclick="calc.txt.value += '-' "><i>-</i></span>

<span class="num" onclick="calc.txt.value += '4' "><i>4</i></span>
<span class="num" onclick="calc.txt.value += '5' "><i>5</i></span>
<span class="num" onclick="calc.txt.value += '6' "><i>6</i></span>
<span class="num" onclick="calc.txt.value += 'Math.sqrt(' "><i>√</i></span>
<span class="num" onclick="calc.txt.value += '%' "><i>%</i></span>

<span class="num" onclick="calc.txt.value += '1' "><i>1</i></span>
<span class="num" onclick="calc.txt.value += '2' "><i>2</i></span>
<span class="num" onclick="calc.txt.value += '3' "><i>3</i></span>
<span class="num" onclick="calc.txt.value += 'Math.sin(' "><i>sin</i></span>
<span class="num" onclick="calc.txt.value += 'Math.cos(' "><i>cos</i></span>
<span class="num" onclick="calc.txt.value += '.' "><i>.</i></span>

<span class="num" onclick="calc.txt.value += '0' "><i>0</i></span>
<span class="num" onclick="calc.txt.value += ',' "><i>,</i></span>
<span class="num" onclick="calc.txt.value += 'Math.pow(' "><i>^</i></span>

<span class="num result-give" onclick="document.calc.txt.value=eval(calc.txt.value)"><i>=</i></span>
</form>
</div>

<script>
let body = document.querySelector('body');
let btn = document.querySelector('.btn');
let calc = document.forms['calc'];
let txt = calc.elements['txt'];
let math = window.math;

btn.onclick = function () {
body.classList.toggle('light')
}

calc.onsubmit = function (e) {
e.preventDefault();
try {
txt.value = math.evaluate(txt.value);
} catch (err) {
txt.value = 'Error';
}
}

</script>
</body>

</html>
49 changes: 0 additions & 49 deletions Calculators/Basic-Calculator/script.js

This file was deleted.

Loading
Loading