C# の単純なコンソール アプリケーションのコードを以下に示します。2 番目の入力に AIR レートを入力すると、「入力文字列が正しい形式ではありませんでした」というエラーが表示されます。正しいフォーマットは何ですか?また、現在作成しているコードにどのように組み込むのですか? 私はさまざまな変数の型に慣れていません。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int AIR, MIR, PMT, IP, PP, ABorrowed, Term;
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 / 1200;
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();
}
}
}