Final Value with Appreciation
Given principal amount
principal as an input, time period in years time and appreciation percentage apprPercentage as optional inputs, write a JS function to return the final value finalValue with the given appreciation percentage and time period. The default values for time and apprPercentage are 2 and 5 respectively.
Quick Tip
The formula to calculate the final value with appreciation is,
finalValue = principal * (1 + time * appreciation / 100)
Sample Input 1
1000
2
3
Sample Output 1
1060
Sample Input 2
3000
Sample Output 2
3300.0000000000005
let principal = +prompt("Enter a pricipal number")
let time = +prompt("Enter a time")
let appreciation = +prompt("input contains a number apprPercentage")
let finalValue
finalValue = principal * (1 + time * appreciation / 100)
console.log(finalValue)
Comments
Leave a comment