Answers for ". Write a C++ program to calculate area of a Triangle"

C++
1

C++ Area of Triangle

//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;
Posted by: Guest on March-09-2022
0

. Write a C++ program to calculate area of a Triangle

#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<<"\nArea = "<<area;
    cout<<endl;
    return 0;
}
Posted by: Guest on April-26-2022
0

. Write a C++ program to calculate area of a Triangle

#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<<"\nArea = "<<area;
    cout<<endl;
    return 0;
}
Posted by: Guest on April-26-2022
0

. Write a C++ program to calculate area of a Triangle

#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<<"\nArea = "<<area;
    cout<<endl;
    return 0;
}
Posted by: Guest on April-26-2022
0

. Write a C++ program to calculate area of a Triangle

#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<<"\nArea = "<<area;
    cout<<endl;
    return 0;
}
Posted by: Guest on April-26-2022

Code answers related to ". Write a C++ program to calculate area of a Triangle"

Browse Popular Code Answers by Language