This C# Program Calculates Compound Interest. Compounding of interest allows a principal amount to grow at a faster rate than simple interest, which is calculated as a percentage of only the principal amount.

Here is source code of the C# Program to Calculate Compound Interest. The C# program is successfully compiled and executed with Microsoft Visual Studio. The program output is also shown below.

`/*`

`* C# Program to Calculate Compound Interest`

`*/`

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();

`}`

`}`

`}`

Here is the output of the C# Program:

Enter the Initial Amount : 1000 Enter the Rate of Interest : 2 Enter the Number of Years : 2 Number of Times the Interest will be Compounded : 2 Your Total for Year 1 is : 1020 Your Total for Year 2 is : 1041

**Sanfoundry Global Education & Learning Series – 1000 C# Programs.**

If you wish to look at all C# Programming examples, go to 1000 C# Programs.