if i place:Code:#include <stdio.h> main() { float price, new_price; char code; printf("Enter the price: "); scanf("%f", &price); printf("Enter the pricing code: "); scanf("%c", &code); if(code=='A') { final_price=price*0.5; printf("New discounted price is %.2f\n", final_price); } else if(code=='B') { final_price=price*0.6; printf("New discounted price is %.2f\n", new_price); } else if(code=='C') { final_price=price*0.7; printf("New discounted price is %.2f\n", new_price); } else if(code=='D') { final_price=price*0.9; printf("New discounted price is %.2f\n", new_price); } else if(code=='E') { final_price=price; printf("New discounted price is %.2f\n", new_price); } else { final_price=price; printf("Invalid pricing code. \n"); } }
printf("Enter the pricing code: ");scanf("%c", &code);
before
printf("Enter the price: ");scanf("%f", &price);
the program runs, but if i put it this way, it doesn't, please help me out here, thanks.