I need this in C programming When you borrow money to buy a house, a car, or for
ID: 3736221 • Letter: I
Question
I need this in C programming
When you borrow money to buy a house, a car, or for some other purposes, then you typically repay it by making periodic payments. Suppose that the loan amount is L, r is the interest rate per year, m is the number of payments in a year, and the loan is for t years. Suppose that i -/m) and r is in decimal. Then the periodic payment is 6. Li You can also calculate the unpaid loan balance after making certain payments. For example, the unpaid balance after making k payments is: where R is the periodic payment. (Note that if the payments are monthly, then m - 12.) Write a program that prompts the user to input the values of L, r, m, t, and k. The m then outputs the appropriate values. Your program must contain at least two unctions, with appropriate parameters, to calculate the periodic payments and the unpaid balance after certain payments. Make the program menu driven and use a loop so that the user can repeat the program for different values.Explanation / Answer
Here is the code
#include<stdio.h>
float periodicPayments(float L,float r,float m,float t,float i){
float x=L*i;
float y=pow(1+i,m*t);
float z=x/(1-(1/y));
return z;
}
float unpaidbalance(float L,float r,float m,float t,float i){
float y=pow(1+i,m*t-k);
float z=(1-(1/y))/i;
return z;
}
int main(){
float L,r,m,t,k;
scanf("%f",&L);
scanf("%f",&r);
scanf("%f",&m);
scanf("%f",&t);
scanf("%f",&k);
float periodicpaymentans=periodicPayments(L,r,m,t,k);
printf(periodicpaymentans);
float unpaidbalanceans=periodicPayments(L,r,m,t,k);
printf(unpaidbalanceans);
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.