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 + "%"); } }
0 comments:
Post a Comment