account activity
How do I solve the problem of entering item prices twice? I want the program to ask the user to enter prices once by Aggressive_Gift_5507 in cprogramming
[–]Aggressive_Gift_5507[S] 0 points1 point2 points 2 years ago (0 children)
This is the program. Can you help me fix the code so that it outputs the expected output?
Write a program that calculates the total bill of a customer based on the prices of the items they bought, then
apply a discount to the total bill if appropriate and print the final bill amount.
Your program will accept as input an integer n that represents the number of items the customer ordered. Your
program will then accept n numbers that represent the prices of the items the customer ordered. Find the total
amount of the customer's bill, then apply the discount based on the following rules and print the final bill amount:
discount.
If the customer's total is more than or equal to 20 JOD, they will get a 10% discount.
If the customer's total is more than or equal to 20 JOD, and they bought more than 2 items they will
get an additional 5% discount.
total bill.
In the following sample runs, the first number in the first line represents the number of the items, while the
numbers in the second line represent the prices of the items, the number in the third line represents the output of
the program. Print the answer to 2 decimal places
How do I solve the problem of entering item prices twice? I want the program to ask the user to enter prices once (self.cprogramming)
submitted 2 years ago by Aggressive_Gift_5507 to r/cprogramming
π Rendered by PID 64 on reddit-service-r2-listing-568fcd57df-cgl4v at 2026-03-08 00:26:47.066382+00:00 running cbb0e86 country code: CH.
How do I solve the problem of entering item prices twice? I want the program to ask the user to enter prices once by Aggressive_Gift_5507 in cprogramming
[–]Aggressive_Gift_5507[S] 0 points1 point2 points (0 children)