using System.Collections.Generic;
public class CompoundInterest
public CompoundInterest(int p,double r)
public double GetInterest(int y){
double allmoney = (double)(Principal*Math.Pow(1+rate,y));
double CI = allmoney - Principal;
public static void Main()
CompoundInterest c = new CompoundInterest(100000,0.035);
Console.WriteLine("p = {0}", c.Principal);
double interest = c.GetInterest(5);
Console.WriteLine("Interest = {0}", interest);