**Q:**

Hello

below is a very short program that is suppose to give a future value or an

equal payment amount. This is driving me bonkers. When I put in amounts

like 500, 1 and 12, I get crazy answers like 1.81e-301. What does this

mean? What am I doing wrong. Any help would be greatly appresiated I am

tearing out my hair!!!!

*************************************************

#include <stdio.h>

#include <math.h>

void main()

{

/* This program will calculate the future value or equal payment amounts

*/

double present,future,equal,interest,periods;

int choice;

printf ("\n This program will calculate Future Value or Equal Payments.");

printf ("\n Enter a 1 for Future Value or a 2 for Equal Payments: ");

scanf ("%i", choice);

/* gather the user inputs */

printf ("\n\n Please enter the present value: ");

scanf ("%lg", present);

printf ("\n Please enter the Interest rate per period: ");

scanf ("%lg", interest);

printf ("\n Please enter the number of interest periods: ");

scanf ("%lg", periods);

if (choice = 1)

{

/* Calculate the Future Value */

future = present * ( pow(1 + interest,periods));

/* Display results */

printf ("\n\n The Future Value is %.4g",future);

}

else

{

/* subsection for calculating Equal Payments */

equal = present * (interest * pow(1 + interest,periods)) / pow(1 +

interest,periods) - 1;

/* Display results */

printf ("\n\n Equal Payment amount is %.4g",equal);

}

}

**A:**

Nothing. That is really the result if your interest rate is 1200% (or you

have to divide the variable interest by 100 :-)

Regards,

Peter

[ back to toc ]