Suppose you have an account that earns 5% interest that is credited to your account at the end of each year. Write a C# program to calculate the number of years it will take before the account balance is at least $2000 if thw initial account balance is $1000.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication5
{
class Program
{
static void Main(string[] args)
{
double bal = 1000;
double ibal;
int years = 0;
for (int i = 1; i <= 100; i++)
{
ibal = bal * 0.05;
bal = bal + ibal;
if (bal >= 2000.0)
{
years = i;
break;
}
}
Console.WriteLine("years to make amount 2000 dollars=" + years);


Console.ReadKey();

}


}
}


www.ittaleem.com