I am having trouble with one requirement for my program. Here it is:
"Your program will continue asking for the sales until the user types a negative number for sales, then the program should ask the user, if he/she wants to terminate the program. The program terminates if the user answers yes or y."
My program prompts the user to input 'y' or 'n' but it does not recognize y or n when it is input. It just jumps to the "Invalid entry" statement and loops back to the beginning.
Your mistake was to compare ans with uninitialised variables y and n... try this one below by just putting 'y' and 'n' instead of y or n. or first initialise your variables y and n then compare them with ans. hope it works!!!