Day 71: Compound Interest of 100DaysCodingChallenge
Hello all,
#day71
Day71
Today's my task was to Write a Program to Print Compound Interest based on the Calculation of Principle, Rate of Interest and Number of Years taken by the user input Using Function.
I have started the 100 days of coding challenge to improve my programming skills..
Code :
let p = prompt("Enter a Principle Amount : "); let r = prompt("Entera Rate of an Interest : "); let t = prompt("Enter a Number of Years : "); //let n = prompt("Enter a Number of Interst Compounded per unit : "); let c = ""; let b = ""; function ci(p, r, t) { let n = r / 100; let i = p * (1 + n); let amount = p * (Math.pow((1 + (r / n)), (n * t))); //let //c += i ^ t; c += Math.pow(i, t); b = p * (Math.pow((1 + r / 100), t)); console.log(`The Compound Interest is ${b}`); } ci(p, r, t);
Output :
Happy Coding:)
Thank you...
Comments
Post a Comment