C# : Program to find Compound Interest

In this C# tutorial we "Find Compound Interest using Principle, Rate and Time" . For this here we are taking four variables "p" for principle ,"r" for rate, "t" for time and "ci" for our compound interest respectively. Also here we are using "Math.Pow" method which takes the powers of numbers such as by squaring values.  Now, lets get started!!

using System;
​class prg
{
 public static void Main(String []args)
 {
        double p,r,t,ci;
        Console.WriteLine("Enter Principle,Rate and Time : ");
        Console.WriteLine("Principle : ");
        p=Convert.ToInt32(Console.ReadLine());
        Console.WriteLine("Rate : ");
        r=Convert.ToInt32(Console.ReadLine());
        Console.WriteLine("Time : ");
        t=Convert.ToInt32(Console.ReadLine());
        ci=Math.Pow(p*(1+r/100),t);
      Console.WriteLine("Compound Interest =" + ci + "%");
}
}
SHARE

Raunak Hajela

Hi. I’m CEO/Founder of Kodestat. I’m Student, Geek, Web Designer, Developer, Blog Enthusiast and Player. Inspired to make things looks better. I like playing with codes plus I am marvel fan :-P You can check my design portfolio here. For consulation fell free to drop an email at raunakhajela@gmail.com.

  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment