Write a C# program to calculate the number of years it will take before the account balance reaches the specified final balance, by having the user enter the interest rate, the initial balance, and the final balance.

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

namespace ConsoleApplication5
{
class Program
{
static void Main(string[] args)
{
double inti, intr, fibal, ibal;
int years = 0;
Console.WriteLine("Enter The intialbalnce");
inti = Double.Parse(Console.ReadLine());
Console.WriteLine("Enter The final balnce");
fibal = Double.Parse(Console.ReadLine());
Console.WriteLine("Enter The intrest rate");
intr = Double.Parse(Console.ReadLine());
intr = intr / 100;



for (int i = 1; i <= 10000; i++)
{
ibal = (inti * intr);
inti = inti + ibal;
if (inti>= fibal)
{
years = i;
break;
}
}
Console.WriteLine("years to make amount final balance=" + years);



Console.ReadKey();

}


}
}


www.ittaleem.com