Question: This is a c program Write a function, named loanCalculation, that calculates the monthly payment AND total payment of a loan given the initial amount,
This is a c program
Write a function, named loanCalculation, that calculates the monthly payment AND total payment of a loan given the initial amount, interest rate, and length of the loan. Use the following equations R-rate 0.01/12 N- years 12 As initial amount Monthly payment R(11RA-N) Total payment -Monthly payment*years 12 Function outputs: monthly payment AND total payment (variables should be passed by POINTER and act as additional inputs) Function inputs: initial amount, interest rate, length of the loan in years. Your program should output the pointer AND value of the initial loan amount, monthly payment, and total payment variables BEFORE the function is called, WITHIN the function, and AFTER the function is called. Example output given an initial loan amount of 20000, interest rate of 6.5, and 5 years for the length of the loan: Loan amount: Loan rate: Length of loan: Before function: Loan amount: Address-0x7ffe887f14f0, Value$20000.00 Monthly payment: Address0x7ffe887f1508, Value0.00 Total payment: Address-0x7ffe887f1510, Value -$0.00 Within function (after calculation): Loan amount: Address-0x7ffe887f14c8, Value -$20000.00 Monthly payment: Address-0x7ffe88711508, Value$410.33 Total payment: Address0x7ffe887f1510, Value-$24619.84 After function: Loan amount: Address = 0x7ffe887f14f0, Value = $20000.00 Monthly payment: Address 0x7ffe887f1508, Value -$410.33 Total payment: Address0x7ffe88711510, Value$24619.84 Note the differences and similarities in address for local function variables versus those passed by pointer
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
