Multiple Ordering System (Using FOR Loop)—Pseudocode
DECLARE items, qty, price, totalBill : INTEGER
DECLARE count : INTEGER
totalBill ← 0
OUTPUT “Enter number of products to order: “
INPUT items
FOR X ← 1 TO items
OUTPUT “Enter quantity of product “, X, “: “
INPUT qty
OUTPUT “Enter price of product “, X, “: “
INPUT price
totalBill ← totalBill + (qty * price)
NEXT X
OUTPUT “————————————–“
OUTPUT “Total Bill = “, totalBill
OUTPUT “————————————–“
How it works (Simple Explanation)
-
The user enters how many items they want to order
-
FOR loop runs for each item
-
For every product, the quantity and price are entered
-
Cost is calculated using:
qty × price -
All costs are added to the total bill
-
The final bill is displayed at the end
If you want, I can also add:
- A version using arrays
- A version with a discount calculation
- A version with STEP (Advanced)
- A version formatted as a flowchart
Just tell me!
