Interest Problem

#include <cstdio>
#include <iostream>
#include <cmath>

using namespace std;

int main ()
{
double l, apr;
int t;
int formula;
bool notValid;

do{
notValid=false;
cout << "\nLoan Amount: " ;
cin >> l;
if (l < 100 || l > 999999.99)
{
cout << "\nLoan amount should be between $100 and $999,999.99";
notValid=true;
}
} while (notValid);

do{
notValid=false;
cout << "\nAnnual Interest Rate: " ;
cin >> apr;
if (apr < 1 || apr > 20)
{
cout << "\nInterest rate should be between 1 % and 20%";
notValid=true;
}
} while (notValid);

do{
notValid=false;
cout << "\nNumber of Payments: " ;
cin >> t;
if (t < 5 || t > 360)
{
cout << "\nNumber of payments should be between 5 and 360 months";
notValid=true;
}
} while (notValid);

formula=l*apr/(1-pow((1+apr),-t));
cout <<"The Monthly Payment\n" <<formula;

system("pause");
return 0;
}

Here is my code, I think the formula is correct. But I can't get a correct monthly payment amount.
Anyone can help me? This is my last problem
Topic archived. No new replies allowed.