C problems that is ^.^
My name is Allen and it's my first time posting a thread here and I figure I'll introduce myself along with a problem I'm having. I'm new to C programming so I'm doing an assignment and the logic seems ok to me but for some reason when I enter lets say 50.99, the while loop won't work right. Here's my code
Code:
printf("What is the cost of small package(s) (in dollars, 0< cost < 500): ");
scanf("%e", &s_pack); //Storing the user's input
//Using while loop to make sure the input is valid
while (s_pack > 500 || s_pack < 0) {
printf("The amount you have entered is not within the parameter.\n");
printf("Please enter the cost of small package(s) in dollars between 0 and 500: ");
scanf("%e", &s_pack);
}
I entered 50.99 which is obviously false in the while loop but the loop ran anyway. I'm pretty sure I did something stupid but I dont know what. I will appreciate it if anyone can help ^.^