public static void Main()
Console.WriteLine("Enter an intial amount to invest: ");
double initialAmount = Convert.ToDouble(Console.ReadLine());
double totalAmount = initialAmount;
while (totalAmount < 1000000)
totalAmount = totalAmount + (0.04 * totalAmount);
Console.WriteLine("At the end of year {0}, total is {1}.",year, totalAmount);