Loading...
Is this your company?
Write a function to calculate compounding interest with the APR as a parameter
Anonymous
Not sure what "years = years + 1" is for in the answer above. It may even cause an infinite loop.
using System; class Program { static void Main() { Console.WriteLine(CompoundInterest(1500, 0.043, 4, 6)); } /// /// CompoundInterest. /// static double CompoundInterest(double principal, double interestRate, int timesPerYear, double years) { // (1 + r/n) double body = 1 + (interestRate / timesPerYear); // nt double exponent = timesPerYear * years; // P(1 + r/n)^nt return principal * Math.Pow(body, exponent); } }
def interest(principle, val, years): for x in range(0,years): principle = principle * (1+val) years = years + 1 return principle
Check out your Company Bowl for anonymous work chats.
Get actionable career advice tailored to you by joining more bowls.
Stay ahead in opportunities and insider tips by following your dream companies.
Get personalised job recommendations and updates by starting your searches.