-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
49 lines (48 loc) · 1.97 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Simple Interest Calculator</title>
<link rel="stylesheet" href="style.css" />
</head>
<script>
function simpleInterestCalculator() {
// alert("Hello Abhi");
const amt = document.getElementById("amount").value;
const ir = document.getElementById("interestRate").value;
const tem = document.getElementById("time").value;
const SI = (parseInt(amt) * parseInt(ir) * parseInt(tem)) / 100;
const write0 = document.getElementById("finalAmount0");
write0.innerHTML = "Principal Amount : " + parseInt(amt);
const write1 = document.getElementById("finalAmount1");
write1.innerHTML = "Amount of interest : " + SI;
const write2 = document.getElementById("finalAmount2");
write2.innerHTML = "Total Amount : " + (SI + parseInt(amt));
}
</script>
<body>
<h1 id="heading">Simple Interest calculator</h1>
<div class="calculator">
<label>Enter Principal Amount : </label>
<input type="number" id="amount" placeholder="Amount" /><br /><br />
<label>Enter Rate of Interest : </label>
<input
type="number"
id="interestRate"
placeholder="Interest Rate"
/><br /><br />
<label>Enter Duration in Years : </label>
<input type="number" id="time" placeholder="Duration" /><br /><br />
<button onclick="simpleInterestCalculator()">
Calculate Final Amount
</button>
</div>
<h1 id="output">Output</h1>
<div class="outputBox">
<div id="finalAmount0"></div>
<div id="finalAmount1"></div>
<div id="finalAmount2"></div>
</div>
</body>
</html>