Skip to content
Worked Examples · Example 4.4

Q.Write an algorithm to calculate area and perimeter of a rectangle, using both pseudocode and flowchart.

CBSENCERTSubjective· 3mImportance★★★★★est
19% · 7/36 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

Read length and breadth, then compute area = length × breadth and perimeter = 2 × (length + breadth) — a straight-line (sequential) algorithm with two process boxes.

The idea. Like the sum-of-two-numbers example, this needs only the sequence construct: two inputs, two formula evaluations, two outputs. The value of writing it out is practising the input → process → output pattern that every flowchart follows.

Pseudocode:

Step 1: INPUT length
Step 2: INPUT breadth
Step 3: area = length * breadth
Step 4: perimeter = 2 * (length + breadth)
Step 5: PRINT area
Step 6: PRINT perimeter

Flowchart (nodes and arrows):

  1. Start (oval)
  2. ↓ Input length, breadth (parallelogram)
  3. ↓ area = length * breadth (rectangle)
  4. ↓ perimeter = 2 * (length + breadth) (rectangle)
  5. ↓ Output area, perimeter (parallelogram)
  6. ↓ Stop (oval)

Python implementation:

length = float(input("Enter length of rectangle: "))
breadth = float(input("Enter breadth of rectangle: "))
area = length * breadth
perimeter = 2 * (length + breadth)
print("Area =", area)
print("Perimeter =", perimeter)

Expected output (sample run):

Enter length of rectangle: 8 …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.