I am working on a tax program. I want to add a section that verifys 
the input from the customer. I added an if-then statement but can't 
seem to get it to work. 
Here is the code.  In the section on function for inputing sales here 
is the error message:line 37: lexical: unknown escape sequence `\P'
'printf ("n\Please enter a valid amount\n")'

What does Lexical: mean? 

/*original version*/
/* ver 2 removed extra semi-colons*/
/* ver 3 added braces in function */
/* ver 4 added conversion specifier*/
/* ver 5 reworked formula for tatal*/

#include <stdio.h>
#include <math.h>
main()
{
    /*setting variables for store choice*/
 
    float fSales;
    float fTax1;
    float fTax2;
    float fTax3;
    float fTotal1;
    float fTotal2;
    float fTotal3;
    
    /*initializing variables*/
  
    fSales = 0;
    fTax1 = .0725;
    fTax2 = .075;
    fTax3 = .0775;
    fTotal1 = 0;
    fTotal2 = 0;
    fTotal3 = 0;
   
   
   /*function for inputing sales*/
        {
        printf ("\nEnter amount of purchase:\n");
        scanf ("%f", &fSales);
        if (fSales <= 0.00);
        printf ("n\Please enter a valid amount\n");
        else
        printf ("\n You entered: %.2f", fSales);
        }
    fTotal1 = (fTax1 * fSales) + fSales;
    fTotal2 = (fTax2 * fSales) + fSales;
    fTotal3 = (fTax3 * fSales) + fSales;
    
    /*function for conditions*/
        {
        printf ("\nYour tax rate at the Del Mar store is .0725"); 
        printf ("\nYour tax on your purchase amount at the Del Mar 
store is: %.2f", fTax1 * fSales);
        printf ("\nYour total at the Del Mar store is: %.2f", 
fTotal1);
        }
        {
        printf ("\nYour tax rate at the Encinitas store is .075");
        printf ("\nYour tax on your purchase amount at the Encinitas 
store is: %.2f\n", fTax2 * fSales);
        printf ("\nYour total at the Encinitas store is: %.2f\n", 
fTotal2);
        }
        {
        printf ("n\Your tax rate at the La Jolla store is .0775");
        printf ("\nYour tax on your purchase amount at the La Jolla 
store is: %.2f", fTax3 * fSales);
        printf ("\nYour total at the La Jolla store is: %.2f", 
fTotal3);
        }
   
     
    }
    

Reply via email to