Help wanted for my little program

Hi everyone!

I am a beginner in c programming, and I would be very very grateful if someone coule take a look at my little program which I wrote and which unfortunately does not really work.

The program calculates the running time and the annuity of a credit, after receiving the necessary values.
However, the formula for the running time does not work. I tried to rewrite this formula, maybe I have made a mistake:
[img=http://upload.wikimedia.org/math/6/0/1/601e4d6340f55585b0d1f15634a1b842.png]
in my programm n is the running time, R is the annuity, S is the amount of the credit, m is the fixed fee and i is the lending rate in per cent.

[code]
#include
#include

double R,m,S,i;

double annuity()
{
double R = 12*m;
return R;
}

int term()
{
int n = -(log(1-(i*S/R))/log(1+i));
return n;
}


main()
{
printf("
Fill in a value for S: ");
scanf("%lf",&S);
printf("
Fill in a value for m: ");
scanf("%lf",&m);
printf("
Fill in a value for i: ");
scanf("%lf",&i);

printf("

The annuity is %.2lf",annuity());
printf("
The running time is %i

", term());
}
[/code]

Thank you in advance and sorry for my bad english!


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories