Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

Write a c++ Program to calculate the area of an equilateral triangle.

#include<iostream>
#include<math.h>
using namespace std;
int main(){
    float side, area;
    cout<<" Input the value of the side of the equilateral triangle: ";
    cin>>side;

    area = (sqrt(3) / 4) * (side * side);

    cout<<" The area of equilateral triangle is: "<<area<<endl;
    return 0;
}
Source by codescracker.com #
 
PREVIOUS NEXT
Tagged: #Write #Program #calculate #area #equilateral
ADD COMMENT
Topic
Name
2+6 =