.NET Fiddle

CSharp · Console

/Program.cs

using System;

public class Program
{
	public static void Main(string[] args)
	{
		byte targetAge;
		byte startAge;
		int targetAmount;
		
		do
		{
			Console.Write("The amount you want to have at the end: ");
		}
		while (!int.TryParse(Console.ReadLine(), out targetAmount));
		
		do
		{
			Console.Write("Your age at the end: ");
		}
		while (!byte.TryParse(Console.ReadLine(), out targetAge));
		
		do
		{
			Console.Write("Your age at the beginning: ");
		}
		while (!byte.TryParse(Console.ReadLine(), out startAge));
		
		Console.WriteLine("\nCalculation  (5% p.a.):\n");
		PrintOverview(targetAge, startAge, targetAmount, 5);
	}

	static void PrintOverview(byte targetAge, byte startAge, int amount, int interestRate)
	{
		for (; targetAge >= startAge; targetAge--)
		{
			Console.WriteLine("At {0} you have to have {1} on your account", targetAge, amount);
			amount = (int)(amount / (1 + (double)interestRate / 100));
		}
	}
}
;