If they choose to add another item, you never calculate the final price and display it for them. Only when they choose not to add another item, meaning
yn != 'y'
which is basically your else statement, this happens:
1 2 3
|
finalprice=(discount*price)/100;
printf("\nYour total price is: %.0f\nPress ENTER to continue", finalprice);
| |
Wouldnt you want to do that if they choose to add another item as well? The final price of both items in that case?
You do this in the if statement
1 2 3 4
|
printf("*******************************\n");
printf("** Your total price is: %.0f **\n", finalprice);
printf("** Press ENTER to continue **\n");
printf("*******************************\n");
| |
You try and print out the final price, final price is not equal to anything. You never give final price a value, you only do it in the else statement.
Im also a bit confused of this
finalprice=(discount*price)/100;
Why the divided by 100? isn't the final price just price*discount. If I have an item for 200 dollars, and the discount 50% off. Wouldnt it just be 200*0.5 = 100 dollars final price? The way you have it, if the item was 200 dollars and the discount was 50% off, the final price would be 10 dollars.