Hey guys., i wrote a little program to calculate the foreign exchange of canadian dollar to french frank. but when i validate an input(it has to be between 1 and a 1000), i get a problem even though it makes user to reenter the number, still the very first number enter is used. any suggestions would be greatly appreciated!!
cheers!

``````#include<stdio.h>

double GetAmount(void);
double AmountValidate(double amount);
double CalcAmount(double amount_c, double exchange_rate);

main()
{

double amount_c; double amount_f;
double exchange_rate=3.528582;

amount_c=GetAmount();
AmountValidate(amount_c);
amount_f=CalcAmount(amount_c, exchange_rate);
PrintResults(amount_c, amount_f);

}

double GetAmount(void)
{
double amount;

printf("Hello, this program will convert CAD to French Franks\n");
printf("The Exchange rate is 3.528582., Enter the amount in CAD:");
scanf("%lf", &amount);
return amount;
}

double AmountValidate(double amount_c)
{

while(amount_c < 1.0 || amount_c >1000.0)
{
printf("Invalid Entry, Must be between 1 and 1000, Please Re-Enter:");
scanf("%lf", &amount_c);
}

return amount_c;
}

double CalcAmount(double amount_c, double exchange_rate)
{

double french_f;

french_f=amount_c*exchange_rate;
return french_f;
}

{
printf("******* Foreign Exchange ********\n");
printf("French francs: %.2lf\n", french_f);
printf("*********************************\n");
}``````
2
Contributors
1
``````amount_c=GetAmount();