所以我对编码相当陌生,我只是把 0 拉回来作为回报。我在运行它时输入了 10000 5 和 10 作为我的 3 个输入,除了所有三个字段的 0 之外,我无法从它返回任何东西。我想也许我的程序想要一个变量的起点,所以我将它们全部声明为 0 开始,但它仍然不起作用。
int AIR, MIR, PMT, IP, PP, ABorrowed, Term;
AIR = 0;
MIR = 0;
PMT = 0;
IP = 0;
PP = 0;
ABorrowed = 0;
Term = 0;
Console.WriteLine("Please enter the amount borrowed on your loan ");
ABorrowed = int.Parse(Console.ReadLine());
Console.WriteLine("Please enter the interest rate for your loan ");
AIR = int.Parse(Console.ReadLine());
Console.WriteLine("Please enter term of your loan in months ");
Term = int.Parse(Console.ReadLine());
MIR = AIR / 12;
PMT = ABorrowed * (MIR/((1-(1/(1+MIR))^Term)));
IP = ABorrowed * MIR;
PP = PMT - IP;
Console.WriteLine("Your total payment for this month is " + PMT);
Console.WriteLine("Of that payment " + IP + " is interest rate");
Console.WriteLine("and the Payment Portion is " + PP);
Console.ReadLine();