# Thread: (Comparing loans with various interest rates)

1. ## (Comparing loans with various interest rates)

(Comparing loans with various interest rates) Write a program that lets the user enter the loan amount and loan period in number of years and displays the monthly and total payments for each annual interest rate starting from 5% to 8%, with an increment of 1/8. Suppose you enter the loan amount 10,000 for five years;
a) Display a table as follows:
Loan Amount: 10000
Number of Years: 5

Interest Rate Monthly Payment Total Payment
----------------------------------------------------
5% 188.71 11322.74
5.125% 189.28 11357.13
5.25% 189.85 11391.59

...
7.85% 202.16 12129.97
8.0% 202.76 12165.83
The formula to compute the monthly payment is as follows:

http://www14.0zz0.com/2010/02/26/13/516993313.png

You don't have to know how this formula is derived. Nonetheless, given the monthly interest rate, number of years, and loan amount, you can use it to compute the monthly payment.
Compute the total payment, which is the monthly payment multiplied by 12 and multiplied by the number of years.
I wrote program for first question , can anybody help me with writing program for Q.2? .

b) If a person can pay monthly around a given amount (for example 200±5), and he wants to take a given loan (for example 10000).
Let the program find how many years needed (between 5 and 15) and what the value of the annualInterstRate (between 5% and 8% with an increment of 1/8.) supposed to be, to pay the taken loan.
(Find all the possibilities in which the person can pay).
Code:
```#include <stdio.h>
#include <stdlib.h>

int main()
{
float m,t;
float p,w,y,r;

printf("Enter loan amount :-\n");scanf("%f",&p);
printf("Enter loan period , with years :-\n");scanf("%f",&y);
printf("Intrest rate  Monthly payment  Total payment\n");
printf("--------------------------------------------\n");

for(r=5;r<=8;r=r+0.125){
w=pow((1+(r/(12*100))),(12*y));
m=((r/(12*100))*p*w)/(w - 1);
t=m*12*y;
printf("%.3f\t\t%.2f\t\t%.2f",r,m,t);
printf("\n");
}

return 0;
}```

2. no anyone can help me !!!

3. ## Loans n rates, shudder!

Come on man its not the best subject to get excited about haha! Several hours hav elapsed since you posted, no further progress? What exactly is it about part2 that gives you trouble? You tackled part one and then gave up? Nothing transfers from earlier?

4. Unless I'm misunderstanding the assignment then b is almost exactly the same as a, except you only print out lines where the monthly payment is below or equal to the inputted amount.

5. _Mike
but i don't know How i can connect a variables

6. ...............

7. but i don't know How i can connect a variables
I am sorry man, your words do not make sense, if you are sitting around waiting for a magic answer i doubt it is going to be provided until you put together a more conscise, (and coherent) description of your actual main issue / sticking points with partB as well as any attempt you have made to complete it.

8. I am sorry man, your words do not make sense, if you are sitting around waiting for a magic answer i doubt it is going to be provided until you put together a more conscise, (and coherent) description of your actual main issue / sticking points with partB as well as any attempt you have made to complete it.
I do not want from you to write my program .. only , I want to understand what is required from the question

9. Perhaps this is a poor English issue? Rogster is correct, your last couple of posts do not make rational sense, so it is hard to answer.

Maybe you should have a look a this:
How To Ask Questions The Smart Way
There are translations into about 20 different languages if you look down the page.

10. For question b, you need to determine the number of years needed to accommodate a loan of X with a monthly payment of Y. Once you find the years, Z, you display the results exactly as question 'a' with loan of X and years of Z.

To find the number of years needed to accommodate a loan of X and stay within a monthly payment of Y +/-5 there are probably many ways. A very simple method could be to simply loop through each year, 5 through 15, calculate the monthly payment for that length of time and see if it matches up with Y +/-5, if so you have a possible answer (you should show all possible loans).