10 si ci
<html>
<head>
<h1><center><font color="green">CALCULATION OF SIMPLE AND COMPOUND INTEREST</font></center></h1>
<script>
function si()
{
var p=parseInt(document.f1.t1.value);
var n=parseInt(document.f1.t2.value);
var r=parseInt(document.f1.t3.value);
var si=(p*n*r)/100;
alert("SIMPLE INTEREST "+si)}
function ci()
{
var p=parseInt(document.f1.t1.value);
var n=parseInt(document.f1.t2.value);
var r=parseInt(document.f1.t3.value);
var ci=(p*Math.pow((1+r/100),n))-p;
alert("COMPOUND INTEREST "+ci)}
</script>
<body>
<center>
<form name="f1">
Principal Amount: <input type="text" name="t1">
<br><br>
Number of years: <input type="text" name="t2">
<br><br>
Rate of Interest: <input type="text" name="t3">
<br><br>
<input type="submit" value="Calculate simple interest" onclick="si()">
<input type="submit" value="Calculate compound interest" onclick="ci()">
</form>
</center>
</body>
</html>
Comments
Post a Comment