Write By C Write By C Title Printing Payments and Calculating Total Expenditure.
ID: 3732129 • Letter: W
Question
Write By C
Write By C
Title Printing Payments and Calculating Total Expenditure. Background Context It is a program that prints out the payment plan fora hous Program Specifications Ask the user to input the amount owed on the house, the interest rate of the loan as a percent peryear, and the monthly payment value. Your program should print a chart with a row for each monthly payment. The columnsof the chart should be the month (this should be a number), the amount of the payment, and the amount owed after the payment is made. All the numbers in the second column should be the same except for possibly the last value. Also, your program should detectif the monthly paymentis too smal to everpay off the loan. If this s the case, simply output an error message instead of the chart. Function details: Yourchart should print out three pieces ofinformation foreach month-the month number starting value printed to2 decimal places in dollars, and the amount still owed, printed to 2 decimal places in dollars. Each value should be separated by eitherone or two tabs (1t"h. Create headers foreach column of the chart. at l, the payment Calculation explanation: he monthly rate isi %. Thu accrued in the first month is e annual interest rate is no00 x.o1 s1on and theloan val o If th $10000Explanation / Answer
#include<stdio.h>
int main()
{
double annualInterest;
double monthlyPayment;
double totalValue;
double remainingValue;
int currentMonth = 1 ;
printf("what is the value left on Mortage ? ");
scanf("%lf",&totalValue);
printf("what is anual interest rate of the value , in percentage ? ");
scanf("%lf",&annualInterest);
printf("what is monthly payment ? ");
scanf("%lf",&monthlyPayment);
remainingValue = totalValue ;
printf("Month Payment Amont Owed ");
while(remainingValue > 0)
{
remainingValue = remainingValue + remainingValue * (annualInterest/12) /100;
double currentMonthPayment = monthlyPayment ;
if(currentMonthPayment > remainingValue ) currentMonthPayment = remainingValue ;
remainingValue = remainingValue - currentMonthPayment;
printf("%d %.2f %.2f ",currentMonth,currentMonthPayment,remainingValue);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.