I am taking an introductory course in C programming and using the Miracle C Compiler for assignments.
I have been trying to find a way to "validate" user input a float variable.
after declaring and initializing a variable called float fSale 0;
// I try variations of
printf ("\nEnter Sale amount $", fSale)
scanf("%f", &fSale);
{
if (fSale > 0)
printf ("\nSale amount %.2f", fSale);
else
printf ("\nMust be a positive amount\n");
{
This does NOT prudce the desired validation. Any suggestions for a newbie ?