Question: #define _CRT_SECURE_NO_WARNINGS #include int main(void) { float amount, rate, monthlypayment; printf(Enter amount of loan: ); scanf(%f, &amount); printf(Enter interest rate: ); scanf(%f, &rate); printf(Enter monthly

#define _CRT_SECURE_NO_WARNINGS #include

int main(void) { float amount, rate, monthlypayment; printf("Enter amount of loan: "); scanf("%f", &amount); printf("Enter interest rate: "); scanf("%f", &rate); printf("Enter monthly payment: "); scanf("%f", &monthlypayment);

//print header printf(" %-5s%15s%15s%15s%15s ", "Month", "Balance", "Interest", "Payment", "Remaining");

double interest = 0; //variable for interest for (int i = 1;i <= 12;i++) { //for 12 months interest = amount * rate / 100 / 12; //find monthly interest printf("%02d %15.2f%15.2f%15.2f", i, amount, interest, monthlypayment); //print the intial amount and interest and monthlypayment amount += interest; amount -= monthlypayment; //change amount printf("%15.2f ", amount); //print the Remaining } return 0; }

From the given codes above can you please answer the following 4 questions. Thanks.

1. Describe how you spaced the table columns and lined them up with the numbers beneath them.

2. Why do you add the interest to the loan before you subtract the monthly payment?

3. Interest rates are quoted as a yearly rate. How do you convert them to be used to calculate the monthly interest?

4. Your program might have had fractional cents in the results. How did you get the proper number of cents displayed?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!