c#,calculate,compound,interest

Samet 8/15/2016 0

This Code Shows How to Calculate Compound Interest

C#
 using System;
namespace compund
{
    class compound
    {
        static void Main(string[] args)
        {
            double Total = 0, interestRate, years, annualCompound, Amount;
            Console.Write("Enter the Initial Amount : ");
            Amount = Convert.ToDouble(Console.ReadLine());
            Console.Write("Enter the Rate of Interest : ");
            interestRate = Convert.ToDouble(Console.ReadLine()) / 100;
            Console.Write("Enter the Number of Years : ");
            years = Convert.ToDouble(Console.ReadLine());
            Console.Write("Number of Times the Interest will be Compounded : ");
            annualCompound = Convert.ToDouble(Console.ReadLine());
            for (int t = 1; t < years   1; t  )
            {
                Total = Amount * Math.Pow((1   interestRate / annualCompound), (annualCompound * t));
                Console.Write("Your Total for Year {0} "
                              "is {1:F0}. \n", t, Total);
 
            }
 
            Console.ReadLine();
        }
    }
} 

Report Bug

Please Login to Report Bug

Reported Bugs

Comments

Please Login to Comment

Comments