Real world → Pseudocode
Everyday situations are full of algorithms. Spot the INPUT, PROCESS, DECISION and OUTPUT — then write the steps.
🌍 Real world → Pseudocode
A customer buys products. If the total exceeds ₹5,000, give a 10% discount. Otherwise give no discount.
Input
The shopping TOTAL.
Process
Work out the discount, then the final amount.
Decision
Is TOTAL more than 5000?
Output
The FINAL_AMOUNT to pay.
Turn it into pseudocode
1BEGIN2 TAKE TOTAL3 IF TOTAL > 5000 THEN4 SET DISCOUNT = TOTAL * 0.105 ELSE6 SET DISCOUNT = 07 END IF8 SET FINAL_AMOUNT = TOTAL - DISCOUNT9 DISPLAY FINAL_AMOUNT10END
🌍 Real world → Pseudocode
An ATM lets you withdraw money only if you have enough balance, and only in multiples of ₹100.
Input
BALANCE and the AMOUNT requested.
Process
Subtract the amount from the balance.
Decision
Is AMOUNT a multiple of 100? Is BALANCE big enough?
Output
The cash + new balance, or a friendly error.
Turn it into pseudocode
1BEGIN2 TAKE BALANCE, AMOUNT3 IF AMOUNT MOD 100 != 0 THEN4 DISPLAY "Please use multiples of 100"5 ELSE IF AMOUNT > BALANCE THEN6 DISPLAY "Not enough balance"7 ELSE8 SET BALANCE = BALANCE - AMOUNT9 DISPLAY "Take your cash. New balance:", BALANCE10 END IF11END
🌍 Real world → Pseudocode
A cinema gives a child ticket (₹150) to anyone under 12, a senior ticket (₹120) from 60 up, and an adult ticket (₹250) otherwise.
Input
The visitor’s AGE.
Process
Choose the right PRICE.
Decision
AGE = 60?
Output
The ticket PRICE.
Turn it into pseudocode
1BEGIN2 TAKE AGE3 IF AGE < 12 THEN4 SET PRICE = 1505 ELSE IF AGE >= 60 THEN6 SET PRICE = 1207 ELSE8 SET PRICE = 2509 END IF10 DISPLAY "Ticket price:", PRICE11END