Needed in C Thank youSolutionHere is the code for you includ
Solution
Here is the code for you:
#include <stdio.h>
 #include <math.h>
 //Reads the inputs principal amount, rate of interest, and number of payments.
 void readInputs(double *presentValue, double *rateOfInterest, int *numOfPayments)
 {
 printf(\"Enter the loan amount: \");
 scanf(\"%lf\", presentValue);
 printf(\"Enter the yearly rate of interest(as a percentage): \");
 scanf(\"%lf\",rateOfInterest);
 *rateOfInterest = (*rateOfInterest/100)/12;
 printf(\"Enter the number of payments: \");
 scanf(\"%i\", numOfPayments);
 }
//Calculates the EMI per payment, given the inputs.
 void EMICalc(double presentValue, double rateOfInterest, int numOfPayments, double *EMI)
 {
 *EMI = (rateOfInterest * presentValue) / (1 - pow((1+rateOfInterest), (-1*numOfPayments)));
 *EMI = floor(*EMI*100+0.5)/100;
 }
 void printTable(double pV, double roI, int noP, double emi)
 {
 printf(\"Principal: %.2lf\ \", pV);
 printf(\"Annual Interest Rate: %.2lf\ \", roI*12*100);
 printf(\"Term in months: %i\ \", noP);
 printf(\"Monthly Payment: $%.2lf\ \ \", emi);
 printf(\"Payment\\tInterest\\tPrincipal\\tPrincipalBalance\ \");
 double interest, principal;
 for(int i = 0; i < noP; i++)
 {
 interest = pV * roI;
 if(interest < 0)
 interest = 0;
 principal = emi - interest;
 if(principal < 0)
 principal = 0;
 pV = pV - principal;
 if(pV < 0)
 pV = 0;
 printf(\"%i\\t$%10.2f\\t$%10.2f\\t$%10.2f\ \", i+1, interest, principal, pV);
 }
 printf(\"Final Payment : $%.2lf\ \",interest+principal);
 }
 int main()
 {
 double presentValue, rateOfInterest, EMI;
 int numOfPayments;
 readInputs(&presentValue, &rateOfInterest, &numOfPayments);
 EMICalc(presentValue, rateOfInterest, numOfPayments, &EMI);
 printTable(presentValue, rateOfInterest, numOfPayments, EMI);
 //cout<<\"The monthly EMI is: \"<<EMI<<endl;
 //double totalInterest = EMI * numOfPayments - presentValue;
 //cout<<\"Total interest paid: \"<<totalInterest<<endl;
   
 }

