

- 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
Program to calculate area and perimeter of equilateral triangle in C++
What is Equilateral Triangle?
As the name suggests, equilateral triangle is the one that have equal sides and also it have equal interior angles of 60° each. It is also known as regular triangle because it’s a regularpolygon
Properties of equilateral triangle are −
- 3 sides of equal length
- Interior angles of same degree which is 60
Given below is the figure of equilateral triangle
Problem
Given with the side of equilateral triangle the task is to find the area and perimeter of a triangle where area is the space occupied by the shape and perimeter is the space occupied by its boundaries.
To calculate area and perimeter of a equilateral triangle there is a formula
Example
Input-: side=14.0 Output-: Area of Equilateral Triangle is : 84.8705 Perimeter of Equilateral Triangle: 42
ALGORITHM
Start Step 1 -> Declare function to calculate area of equilateral trainagle Float area(float side) Return sqrt(3) / 4 * side * side Step 2 -> Declare function to calculate perimeter of equilateral trainagle Float perimeter(float side) Return 3 * side Step 3 -> In main() float side = 14.0 call area(side) call perimeter(side) Stop
CODE
#include <bits/stdc++.h> using namespace std; //function to calculate area of equilateral triangle float area(float side){ return sqrt(3) / 4 * side * side; } //function to calculate perimeter of equilateral triangle float perimeter(float side){ return 3 * side; } int main(){ float side = 14.0; cout << "Area of Equilateral Triangle is : "<<area(side); cout << "\nPerimeter of Equilateral Triangle: "<<perimeter(side); return 0; }
Output
Area of Equilateral Triangle is : 84.8705 Perimeter of Equilateral Triangle: 42
- Related Questions & Answers
- 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 calculate area of Circumcircle of an Equilateral Triangle
- Program to calculate area of Circumcircle of an Equilateral Triangle in C++
- Program to calculate area and perimeter of Trapezium
- Area of circle which is inscribed in equilateral triangle in C Program?
- C Program for Area And Perimeter Of Rectangle
- Find the area and perimeter of right triangle in PL/SQL
- Area of circle which is inscribed in an equilateral triangle?
- How to calculate the area and perimeter of a circle in JavaScript?
- Program to calculate area and perimeter of a rhombus whose diagonals are given What is rhombus in C++?
- Program to find the Area and Perimeter of a Semicircle in C++
- Program to Calculate the Perimeter of a Decagon in C program
- Find Perimeter of a triangle in C++
- Area of a square inscribed in a circle which is inscribed in an equilateral triangle in C Program?
Advertisements