求助?do..while语句怎么改成for语句。
说明关于银行的存款代码: 变量yuge:银行卡余额;lixilv:利息率 ;yigezhi :一个期望的值。static void Main(string[] args)
{
double yuge, lixilv, yigezhi;
Console.WriteLine(" what is your current yuge?");
yuge = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("what is your current annual interest rate (in %)?");
lixilv = 1 + Convert.ToDouble(Console.ReadLine()) / 100;
Console.WriteLine("what balance would you like to have?");
yigezhi = Convert.ToDouble(Console.ReadLine());
int totaln = 0;
do
{
yuge *= lixilv;
++totaln;
}
while(yuge < yigezhi);
Console.WriteLine("in{0}year{1}you havea yuge{2}.",totaln,totaln== 1?"":"s",yuge);
Console.ReadLine();
}
运行结果没问题。do..while语句怎么改成for语句。
内容不变。谢谢各位大侠。