I have the below code for a simple console application in C#. Whenever I input the AIR rate for the second input I get "input string was not in correct format" as the error. What is the correct format and how do I incorporate it into the current code I have made? I am not familiar with different variable types.
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();
}
}
}
PMT =line, as well. ^ doesn't mean "to the power of" - it does a "bitwise or".