- 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

Tringle is a closed figure with three sides. An equilateral triangle has all sides equal. Area and perimeter of an equilateral triangle can be found using the below formula,

Area of equilateral triangle = (√3)/4*a^{2}

Perimeter of equilateral triangle = 3 * a

## Logic of Code

To find the area of an equilateral triangle program uses square-root and power functions. The math library has both these functions and can be used to do the calculation in the program.

The below code display program to calculate the area and perimeter of an equilateral triangle,

## Example

#include <stdio.h> #include <math.h> int main(){ int side = 5, perimeter; float area; perimeter = (3 * side); area = (sqrt(3)/4)*(side*side); printf("perimeter is %d\n", perimeter); printf("area is %f", area); return 0; }

## Output

perimeter is 15 area is 10.825317

- Related Questions & Answers
- Program to calculate area and perimeter of equilateral triangle 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 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?
- 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?
- C Program for Area And Perimeter Of Rectangle
- How to Calculate the Area of a Triangle using Python?
- 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++?
- Java Program to calculate the area of a triangle using Heron's Formula

Advertisements