Building a Simple Interest Rate Calculator using JavaScript and Html
The source code :
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Simple Interest Calculator</title>
<script type="text/javascript">
function cal()
{
p = document.getElementById("p").value;
r = document.getElementById("r").value;
n = document.getElementById("n").value;
alert ("Simple Interest of Principal amount ="+(p*n*r/100));
}
</script>
</head>
<body>
<h1>Simple Interest Calculator</h1>
Amount: <input id="p"><br>
Rate of Interest: <input id="r"><br>
Time (in years): <input id = "n"><br>
<button onclick ="cal()"> OK</button>
</body>
</html>
Comments
Post a Comment