//uisng Heron's Formula
float first, second, third, semiperimeter, area;
cout << "Input the first side of the triangle: ";
cin >> first;
cout << "Input the first side of the triangle: ";
cin >> second;
cout << "Input the third side of the triangle: ";
cin >> third;
semiperimeter = (first + second + third)/2;
area = sqrt (semiperimeter*(semiperimeter-first)*(semiperimeter-second)*(semiperimeter-third));
cout << "The area of the triangle is " << area << endl;
#include<iostream>
using namespace std;
int main()
{
float b, h, area;
cout<<"Enter Base length of Triangle: ";
cin>>b;
cout<<"Enter Height length of Triangle: ";
cin>>h;
area = 0.5*b*h;
cout<<"
Area = "<<area;
cout<<endl;
return 0;
}
#include<iostream>
using namespace std;
int main()
{
float b, h, area;
cout<<"Enter Base length of Triangle: ";
cin>>b;
cout<<"Enter Height length of Triangle: ";
cin>>h;
area = 0.5*b*h;
cout<<"
Area = "<<area;
cout<<endl;
return 0;
}
#include<iostream>
using namespace std;
int main()
{
float b, h, area;
cout<<"Enter Base length of Triangle: ";
cin>>b;
cout<<"Enter Height length of Triangle: ";
cin>>h;
area = 0.5*b*h;
cout<<"
Area = "<<area;
cout<<endl;
return 0;
}
#include<iostream>
using namespace std;
int main()
{
float b, h, area;
cout<<"Enter Base length of Triangle: ";
cin>>b;
cout<<"Enter Height length of Triangle: ";
cin>>h;
area = 0.5*b*h;
cout<<"
Area = "<<area;
cout<<endl;
return 0;
}
#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;
}
Code Example |
---|
Cpp :: c++ garbage collection |
Cpp :: Euler constant |
Cpp :: volumeof a sphere |
Cpp :: Reverse a linked list geeksforgeeks in c++ |
Cpp :: variadic template in c++ |
Cpp :: Ninja c++ |
Cpp :: cin does not wait for input |
Cpp :: for auto c++ |
Cpp :: cpp malloc |
Cpp :: c++ include < vs "" |
Cpp :: async multi thread |
Cpp :: cpp vector popback |
Cpp :: runtime |
Cpp :: right shift in c++ |
Cpp :: options select from array |
Cpp :: C++ function inside main |
Cpp :: split text c++ |
Cpp :: How to see gateway on linux |
Cpp :: C++ insert character |
Cpp :: sstream c++ |
Cpp :: summation of numbers using function |
Cpp :: c++ how to do a pointer char to take varols from keyboard |
Cpp :: how to do if command in c++ |
Cpp :: c++ round number to 2 decimal places |
Cpp :: find n unique integers sum up to zero |
Cpp :: c++ program to convert fahrenheit to kelvin |
Cpp :: find substring after character |
Cpp :: CodeChef Starters 30 Division 4 (Rated) Swapping Chefs Way |
Cpp :: Password codechef solution in c++ |
Cpp :: bnchch |