Algorithm to Calculate Area of Shapes

Subject: PPS (Programming for Problem Solving)

Contributed By: Sanjay

Created At: February 3, 2025

Question:


Write an algorithm to Calculate Area of Different Shapes

Explanation Video:

Custom Image

Explanation:

Algorithm:

  1. Start.

  2. Read the shape (Square, Rectangle, Circle, Triangle).

  3. Based on the shape: 

    • Square: Read side s, calculate area = s * s.

    • Rectangle: Read length l and breadth b, calculate area = l * b.

    • Circle: Read radius r, calculate area = 3.14 * r * r.

    • Triangle: Read base b and height h, calculate area = 0.5 * b * h.

  4. Print the area.

  5. Stop.

Share this Article & Support Us:
Status
printf('Loading...');