Hello I am working a C++ program and the calculation is giving me the wrong total of 1317.2 when it should be 1167.1. Can you look at my code and algorithm to see what I am missing or doing wrong? I cant seem to figure this out. Thanks very much.
Code:
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
int loan = 200000;
int y = 30;
int monthlyterm = y*12;
double i = .00575; //interest rate
double monthlypayment;
monthlypayment = (loan*i)/(1-pow(1+i,-monthlyterm));
cout<<"monthly payment is $"<<monthlypayment;
return 0;
Comment