- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

Trapezium is a type of quadrilateral that has at least one pair of side parallel to each other. Area and perimeter of a trapezium can be found using the below formula,

Perimeter = sum of all sides

Area = ½ x (sum of the lengths of the parallel sides) x perpendicular distance between parallel sides

**Code logic** − The code will use 5 variables in as all sides of trapezium and one for the perpendicular distance between the two parallel side. For the area variable calculation we will take a float variable that will be initialised with the value. To calculate it we will use the formula “ ½ x (sum of length of parallel sides) x perpendicular distance between parallel sides ”. For the perimeter calculation a variable will be assigned the expression, “(Sum of all sides)”.

Below code displays the program to calculate the area and perimeter of a trapezium,

#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 \n", a,b,c,d); printf("Distance between two parallel sides is %d \n", h); perimeter = a+b+c+d; area = 0.5 * (a + b) * h ; printf("Perimeter of the trapezium is %.1f\n", perimeter); printf("Area of the trapezium is: %.3f", 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: 12.500

- Related Questions & Answers
- Program to calculate area and perimeter of equilateral triangle
- Program to calculate area and perimeter of equilateral triangle in C++
- How to calculate the area and perimeter of a circle in JavaScript?
- C Program for Area And Perimeter Of Rectangle
- Program to calculate area of Enneagon
- Program to calculate Area Of Octagon
- Program to calculate area and perimeter of a rhombus whose diagonals are given What is rhombus in C++?
- Program to calculate the Area and Perimeter of Incircle of an Equilateral Triangle What is Equilateral Triangle in C?
- Program to calculate area and volume of a Tetrahedron
- Program to find the Area and Perimeter of a Semicircle in C++
- Program to Calculate the Perimeter of a Decagon in C program
- C++ Perimeter and Area of Varignon’s Parallelogram
- Program to calculate the area of a Tetrahedron
- Java Program to calculate area of a Tetrahedron
- Golang Program to Create a Class and Compute the Area and Perimeter of a Circle

Advertisements