#include<stdio.h>
#include <math.h>
double calculatePayments(double rate, double loan, int payments);
int main() {
double principal, i, monthlyP;
int month;
printf ("Enter the principal amount: "); scanf ("%lf", &principal
);
printf ("Enter the interest amount: ");
printf ("Enter the term in months: ");
monthlyP = calculatePayments (i, principal, month);
printf ("The monthly payment amount is %.2f: ", monthlyP
); return 0;
}
double calculatePayments(double rate, double loan, int payments) {
double mul
= pow(1+rate
, payments
); return (loan * mul * rate) / (mul - 1);
}
I2luY2x1ZGU8c3RkaW8uaD4KI2luY2x1ZGUgPG1hdGguaD4KCmRvdWJsZSBjYWxjdWxhdGVQYXltZW50cyhkb3VibGUgcmF0ZSwgZG91YmxlIGxvYW4sIGludCBwYXltZW50cyk7CgoKaW50IG1haW4oKSB7CgogICAgZG91YmxlIHByaW5jaXBhbCwgaSwgbW9udGhseVA7CiAgICBpbnQgbW9udGg7CgoKICAgICAgICBwcmludGYgKCJFbnRlciB0aGUgcHJpbmNpcGFsIGFtb3VudDogIik7CiAgICAgICAgc2NhbmYgKCIlbGYiLCAmcHJpbmNpcGFsKTsKCiAgICAgICAgcHJpbnRmICgiRW50ZXIgdGhlIGludGVyZXN0IGFtb3VudDogIik7CiAgICAgICAgc2NhbmYgKCIlbGYiLCAmaSk7CgogICAgICAgIHByaW50ZiAoIkVudGVyIHRoZSB0ZXJtIGluIG1vbnRoczogIik7CiAgICAgICAgc2NhbmYgKCIlZCIsICZtb250aCk7CgogICAgICAgIG1vbnRobHlQID0gY2FsY3VsYXRlUGF5bWVudHMgKGksIHByaW5jaXBhbCwgbW9udGgpOwoKICAgICAgICBwcmludGYgKCJUaGUgbW9udGhseSBwYXltZW50IGFtb3VudCBpcyAlLjJmOiAiLCBtb250aGx5UCk7CiAgICAgICAgcmV0dXJuIDA7CiAgICB9CgoKZG91YmxlIGNhbGN1bGF0ZVBheW1lbnRzKGRvdWJsZSByYXRlLCBkb3VibGUgbG9hbiwgaW50IHBheW1lbnRzKSB7CiAgICBkb3VibGUgbXVsID0gcG93KDErcmF0ZSwgcGF5bWVudHMpOwogICAgcmV0dXJuIChsb2FuICogbXVsICogcmF0ZSkgLyAobXVsIC0gMSk7Cn0=