diff --git a/Calculators/Lottery-Odds-Calculator/README.md b/Calculators/Lottery-Odds-Calculator/README.md new file mode 100644 index 000000000..bf4cf4bf2 --- /dev/null +++ b/Calculators/Lottery-Odds-Calculator/README.md @@ -0,0 +1,15 @@ +#

Lottery Odds Calculator

+ +## Description :- + +A calculator that calculates your chances of winning the lottery by taking the input as the number of tickets sold and the number of tickets bought by you. + +## Tech Stacks :- + +- HTML +- CSS +- JavaScript + +## Screenshots :- + +![image](https://github.com/user-attachments/assets/c850c5f9-19e7-4e12-bcf2-606661176d74) diff --git a/Calculators/Lottery-Odds-Calculator/index.html b/Calculators/Lottery-Odds-Calculator/index.html new file mode 100644 index 000000000..b73eaea7d --- /dev/null +++ b/Calculators/Lottery-Odds-Calculator/index.html @@ -0,0 +1,33 @@ + + + + + + + + Lottery Odds Calculator + + + +
+

Lottery Odds Calculator

+
+ +
+ + + + + + + +
+
+ Your chances of winning the lottery are: +

+
+ + + + + diff --git a/Calculators/Lottery-Odds-Calculator/script.js b/Calculators/Lottery-Odds-Calculator/script.js new file mode 100644 index 000000000..c1726e1da --- /dev/null +++ b/Calculators/Lottery-Odds-Calculator/script.js @@ -0,0 +1,21 @@ +function calculate() { + // Get input values + const tickets = parseFloat(document.getElementById('tickets').value); + const sold = parseFloat(document.getElementById('sold').value); + + // Validate inputs + if (isNaN(tickets) || isNaN(sold) || sold <= 0) { + document.getElementById('result').textContent = 'Please enter the values'; + return; + } + + // Perform the calculation + let r = tickets / sold; + r = r * 100; + let result = r.toFixed(2); // Limit to two decimal places + result += "%"; + + // Display the result + const resultElement = document.getElementById('result'); + resultElement.textContent = result; +} diff --git a/Calculators/Lottery-Odds-Calculator/style.css b/Calculators/Lottery-Odds-Calculator/style.css new file mode 100644 index 000000000..dbce005e3 --- /dev/null +++ b/Calculators/Lottery-Odds-Calculator/style.css @@ -0,0 +1,72 @@ +body { + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + margin: 0; + padding: 0; + background-color: #aaf0dd; +} + +header { + background-color: #3c25e8; + color: #fff; + text-align: center; + padding: 1em; +} + +#calculator { + max-width: 300px; + margin: 20px auto; + border: 2px solid #0c0101; + padding: 20px; + border-radius: 8px; + background: linear-gradient(to right, #deec76, #15df0e); + background-color: #fff; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); + text-align: center; +} + +label { + display: block; + margin-bottom: 8px; + color: #333; +} + +input, +select { + width: 100%; + padding: 10px; + margin-bottom: 16px; + box-sizing: border-box; + border-radius: 9px; +} + +button { + width: 100%; + height: 40px; + font-size: 16px; + cursor: pointer; + background-color: #103cee; + color: #fff; + border: none; + border-radius: 9px; + transition: background-color 0.3s; +} + +button:hover { + background-color: #45a09e; +} + +#result { + margin-top: 16px; + font-weight: bold; + color: red; + text-align: center; + font-size: 22px; +} + +#base { + font-weight: bold; +} + +#value { + font-weight: bold; +} diff --git a/index.html b/index.html index dfac3e2fc..c3cd84eb7 100644 --- a/index.html +++ b/index.html @@ -2985,6 +2985,20 @@

Calculates the Force on a moving charge in a magnetic field.

+
+
+

Lottery Odds Calculator

+

Calculates the chances of winning the lottery.

+ +
+

Love Calculator