//Calculating Compound Interest program in C#
using System;
using System.Windows.Forms;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
decimal amount, principal = (decimal)1000.00;
double rate = .05;
string output;
output = "Year\tAmount on Deposit\n";
for (int year = 1; year <= 10; year++)
{
amount = principal * (decimal)Math.Pow(1.0 + rate, year);
output += year + "\t" + amount + "\n";
}
MessageBox.Show(output,"Calculating Compound Interest in C#",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
}
No comments:
Post a Comment