Skip to content
Activities · Activity 4.5

Q.Write an algorithm to take as input the measurement of length and breadth in feet and inches (e.g., 5 ft 6 inch) of a rectangular shape and calculate its area and perimeter.

Tamil Nadu DgeTextbookSubjective· 3mImportance★★★★★est
28% · 10/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 →

Mixed units can't go straight into a formula — first convert each dimension to inches (feet × 12 + inches), then apply area = L × B and perimeter = 2 × (L + B), and convert back to feet-and-inches for a friendly display.

The idea. The twist over the plain rectangle example is unit conversion: "5 ft 6 inch" is two numbers in different units. The clean algorithm normalises everything to the smaller unit (1 foot = 12 inches) before computing, and converts back (integer division and remainder by 12) when displaying.

Algorithm:

Step 1: INPUT lft, lin        // length: feet part, inches part
Step 2: INPUT bft, bin        // breadth: feet part, inches part
Step 3: L = lft * 12 + lin    // total length in inches
Step 4: B = bft * 12 + bin    // total breadth in inches
Step 5: area = L * B                    // square inches
Step 6: perimeter = 2 * (L + B)         // inches
Step 7: PRINT area (and area / 144 for square feet)
Step 8: PRINT perimeter as feet = perimeter DIV 12, inches = perimeter MOD 12

Python implementation:

lft = int(input("Length - feet: "))
lin = int(input("Length - inches: "))
bft = int(input("Breadth - feet: "))
bin_ = int(input("Breadth - inches: "))

L = lft * 12 + lin          # length in inches
B = bft * 12 + bin_         # breadth in inches

area = L * B                # square inches
perimeter = 2 * (L + B)     # inches

print("Area =", area, "sq inches (=", area / 144, "sq ft)")
print("Perimeter =", perimeter, "inches (=",
      perimeter // 12, "ft", perimeter % 12, "inch)")

Expected output (sample run: length 5 ft 6 in, breadth 4 ft 3 in):

Length - feet: 5
Length - inches: 6
Breadth - feet: 4
Breadth - inches: 3 …

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.