JavaScript program to calculate interest
Following program shows you how to calculate interest.
In this program we get investment, interest rate and time from user and calculate interest using following formula
Interest = investment X interestRate X time / 100
var investment = parseInt(prompt("Enter investment:"));
var interestRate = parseInt(prompt("Enter interest rate:"));
var time = parseInt(prompt("Enter Enter number of years:"));
var interest = investment * interestRate * time / 100;
console.log("Interest amount is: " + interest);
Output:
Enter investment:
100000
Enter interest rate:
24
Enter number of years:
2
Interest amount is: 48000