# two errors, help!

• 03-27-2010
j.vick
two errors, help!
Hey everyone!

I'm new to programming (taking a class in C) and have two errors I don't know how to fix.
The errors are:

try1.c:17: error: conflicting types for calculateMonthlyPayment
try1.c:12: error: previous implicit declaration of calculateMonthlyPayment was here

I know they're related, but can't figure out how to correct them. Help?

Program:

Code:

```#include <stdio.h> #include <math.h> double calculateMontlyPayment (double amount, double rate, double years); void printInformation (double amount, double rate, double years, double calculate); int main () { double rate, amount, years, calculate; printf ("Enter the loan amount, interest rate (as a percent), and number of years for the loan\n\n"); scanf ("%lf%lf%lf", &amount, &rate, &years); calculate=calculateMonthlyPayment (amount, rate, years); printInformation (amount, rate, years, calculate); return 0; } double calculateMonthlyPayment (double amount, double rate, double years) { return ((rate*pow((1.0+rate), (years*12.0)))/(pow((1.0+rate), (years*12.0))-1.0)*amount); } void printInformation (double amount, double rate, double years, double calculate) { printf ("The amount of the loan:  %6.2lf\n", amount); printf ("Interest rate per year (user entered):  %6.2lf\n", rate); printf ("Interest rate per month:          \n"); printf ("Number of years:  %6.2lf\n", years); printf ("Number of months:  %6.2lf\n", (years*12)); printf ("Monthly payment:  %6.2lf\n", calculate); }```
• 03-27-2010
vart
you are missing h in Montly in function prototype...
• 03-27-2010
j.vick
thank you :) No one else caught that, even the professor.
• 03-27-2010
All those carrots as a kid, are paying off, Vart! ;)
• 03-27-2010
vart
Quote:

All those carrots as a kid, are paying off, Vart! ;)

just paying attention to the compiler, as someone said - compiler programmers do not choose their messages out of the blue...
• 03-27-2010
quzah
Quote:

Originally Posted by vart
just paying attention to the compiler, as someone said - compiler programmers do not choose their messages out of the blue...

That's just crazy talk!

Quzah.
• 03-28-2010
vart
Quote:

Originally Posted by quzah
That's just crazy talk!

Quzah.

you mean you just ignore everything your compiler tells you? I thought better of you...