Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
Program to calculate area and perimeter of Trapezium
A trapezium is a quadrilateral that has at least one pair of parallel sides. The area and perimeter of a trapezium can be calculated using specific mathematical formulas.
Syntax
Perimeter = side1 + side2 + side3 + side4 Area = 0.5 * (parallel_side1 + parallel_side2) * height
Formula Explanation
- Perimeter: Sum of all four sides of the trapezium
- Area: Half the product of the sum of parallel sides and the perpendicular distance between them
Example
This program calculates the area and perimeter of a trapezium using the given measurements −
#include <stdio.h>
int main() {
int a = 2, b = 3, c = 5, d = 4, h = 5;
float area, perimeter;
printf("The sides of trapezium are %d, %d, %d, %d<br>", a, b, c, d);
printf("Distance between two parallel sides is %d<br>", h);
/* Calculate perimeter (sum of all sides) */
perimeter = a + b + c + d;
/* Calculate area using trapezium formula */
/* Assuming sides 'a' and 'c' are parallel sides */
area = 0.5 * (a + c) * h;
printf("Perimeter of the trapezium is %.1f<br>", perimeter);
printf("Area of the trapezium is: %.3f<br>", area);
return 0;
}
The sides of trapezium are 2, 3, 5, 4 Distance between two parallel sides is 5 Perimeter of the trapezium is 14.0 Area of the trapezium is: 17.500
Key Points
- In this example, we assume sides with lengths 2 and 5 are the parallel sides
- The height (perpendicular distance) is 5 units
- Area formula requires identifying which sides are parallel
- Perimeter calculation is straightforward − just sum all four sides
Conclusion
Calculating the area and perimeter of a trapezium involves simple arithmetic operations using standard geometric formulas. The key is correctly identifying the parallel sides for area calculation.
Advertisements
