
- C Programming Tutorial
- C - Home
- C - Overview
- C - Environment Setup
- C - Program Structure
- C - Basic Syntax
- C - Data Types
- C - Variables
- C - Constants
- C - Storage Classes
- C - Operators
- C - Decision Making
- C - Loops
- C - Functions
- C - Scope Rules
- C - Arrays
- C - Pointers
- C - Strings
- C - Structures
- C - Unions
- C - Bit Fields
- C - Typedef
- C - Input & Output
- C - File I/O
- C - Preprocessors
- C - Header Files
- C - Type Casting
- C - Error Handling
- C - Recursion
- C - Variable Arguments
- C - Memory Management
- C - Command Line Arguments
- C Programming useful Resources
- C - Questions & Answers
- C - Quick Guide
- C - Useful Resources
- C - Discussion
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*a2
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
", perimeter); printf("area is %f", area); return 0; }
Output
perimeter is 15 area is 10.825317
- Related Articles
- Swift Program to Calculate Area and Perimeter of Equilateral Triangle
- Program to calculate area and perimeter of equilateral triangle in C++
- Program to calculate the Area and Perimeter of Incircle of an Equilateral Triangle\nWhat 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
- Calculate the area and perimeter of the following shapes:Q.1 Calculate the area of Square and rectangleQ.2 Calculate perimeter of Square and rectangle."\n
- Explain the perimeter and area of a triangle.
- Area of circle which is inscribed in equilateral triangle in C Program?
- The side of an equilateral triangle is shown by \( l \). Express the perimeter of the equilateral triangle using \( l \).
- How to calculate the area and perimeter of a circle in JavaScript?
- JavaScript program to find Area and Perimeter of Rectangle
- Area of circle which is inscribed in an equilateral triangle?
- C Program for Area And Perimeter Of Rectangle
- $AD$ is an altitude of an equilateral triangle $ABC$. On $AD$ as base, another equilateral triangle $ADE$ is constructed. Prove that Area($\triangle ADE$):Area($\triangle ABC$)$=3:4$.

Advertisements