only 1 testcase is getting fail where its loged in console as NAN. The formula to calculate the final value with appreciation is, finalValue = principal * (1 + time * appreciation / 100).
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.
Input
1)2000
Expected
2200
<script>
let p = parseInt(prompt())
let t = parseInt(prompt())
let a = parseInt(prompt())
const foo = (p, t, a) => {
let finalValue = p*(1+t*a/100);
return finalValue;
}
alert(foo)
</script>
Comments
Leave a comment