I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class csharpExercise
{
static void Main(string[] args)
{
float amount, rate, intrest, time, ci, a;
/*Reading amount, rate of intrest
and period in years from user
*/
Console.Write("Type the amount : ");
amount = Convert.ToInt32(Console.ReadLine());
Console.Write("Type the interest rate : ");
rate = Convert.ToInt32(Console.ReadLine());
Console.Write("Type the period in years: ");
time = Convert.ToInt32(Console.ReadLine());
intrest = 1+(rate/100);
// ci=pow(intrest,time);
ci = 1;
for(a = 1; a <= time; a++)
ci = ci * intrest;
ci = amount * ci - amount;
Console.WriteLine("Your compound interest is : "+ ci);
Console.ReadLine();
}
}
I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability.
Result:
Type the amount : 5000
Type the interest rate : 10
Type the period in years: 1
Your compound interest is : 500
need an explanation for this answer? contact us directly to get an explanation for this answer