- 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

In this problem, we will see the perimeter of a triangle, formula for the perimeter of different types of triangle and program to find them.

**Perimeter** is defined as the total distance about the figure. Basically, it is the sum of all sides of the given figure.

**Perimeter of a triangle**

The perimeter of a triangle is the sum of all its three sides (triangle is a three sides figure).

**Formula,**

Perimeter = sum of all sides

Perimeter = x + y + z

**Program to find the perimeter of a triangle,**

#include <iostream> using namespace std; int calcPerimeter(int x, int y, int z ){ int perimeter = x + y + z; return perimeter; } int main(){ int x = 5, y = 7, z = 8; cout<<"The side of the triangle are \n"; cout<<"X = "<<x<<"\tY = "<<y<<"\tZ = "<<z<<endl; cout<<"The perimeter of the triangle is "<<calcPerimeter(x, y, z); return 0; }

The side of the triangle are

X = 5 Y = 7 Z = 8 The perimeter of the triangle is 20

**Perimeter of different type of triangles,**

In mathematics, there are different types of triangle with some special properties. Though the basic formula of the perimeter remains the same, there are specific formulas of all types of triangle. Let’s see each of them.

It is a special type of triangle in which all sides and angles are equal.

Perimeter = 3*a

**Program to find the area of equilateral triangle,**

#include <iostream> using namespace std; int calcPerimeter(int a){ int perimeter = 3*a; return perimeter; } int main(){ int a = 5; cout<<"The side of the equilateral triangle are \n"; cout<<"a = "<<a<<endl; cout<<"The perimeter of the triangle is "<<calcPerimeter(a); return 0; }

The side of the equilateral triangle are

a = 5 The perimeter of the triangle is 15

It is a special type of triangle in which two sides are equal and the third one has different length.

Perimeter = 2*X + Y

**Program to find the perimeter of isosceles triangle,**

#include <iostream> using namespace std; int calcPerimeter(int x, int y){ int perimeter = 2*x + y; return perimeter; } int main(){ int x = 5, y = 8; cout<<"The side of the Isosceles triangle are \n"; cout<<"X = "<<x<<"\tY = "<<y<<endl; cout<<"The perimeter of the triangle is "<<calcPerimeter(x, y); return 0; }

The side of the Isosceles triangle are

X = 5 Y = 8 The perimeter of the triangle is 18

It is a triangle whose all three sides are different.

Perimeter = x + y + z

- Related Questions & Answers
- Maximum Perimeter Triangle from array in C++
- Program to find largest perimeter triangle using Python
- Largest Perimeter Triangle in Python
- Find the perimeter of a cylinder in C++
- Program to calculate area and perimeter of equilateral triangle in C++
- Program to calculate area and perimeter of equilateral triangle
- Program to calculate the Area and Perimeter of Incircle of an Equilateral Triangle What is Equilateral Triangle in C?
- Program to find Circumcenter of a Triangle in C++
- Picking the triangle edges with maximum perimeter JavaScript
- Find the perimeter of a cylinder in Python Program
- Program to find the Area and Perimeter of a Semicircle in C++
- Python Program for Find the perimeter of a cylinder
- Java Program to find the perimeter of a cylinder
- Find other two sides of a right angle triangle in C++
- Program to find Perimeter / Circumference of Square and Rectangle in C++

Advertisements