- Related Questions & Answers
- Minimum height of a triangle with given base and area in C++
- Area of Reuleaux Triangle?
- Area of squares formed by joining midpoints repeatedly in C?
- Area of Circumcircle of a Right Angled Triangle?
- Java program to find the area of a triangle
- Area of squares formed by joining mid points repeatedly in C Program?
- How to Calculate the Area of a Triangle using Python?
- Program to calculate area and perimeter of equilateral triangle
- Find the altitude and area of an isosceles triangle in C++
- Area of a triangle inside a parallelogram in C++
- How to print a triangle formed of '#' using JavaScript?
- C++ Program to Compute the Area of a Triangle Using Determinants
- Area of the Largest Triangle inscribed in a Hexagon in C++
- Area of Incircle of a Right Angled Triangle in C Program?
- Area of Circumcircle of a Right Angled Triangle in C Program?

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

Here we will see how to get the area of a triangle formed by the x and y axis and another straight line. The diagram will be look like below. The equation of the straight line is −

𝑎𝑥+𝑏𝑦+𝑐=0

The line is cutting the x-axis at the point B, and cutting the y-axis at the point A. The intercept form will be like below −

So the x-intercept is −𝑐∕𝑎 and y-intercept is −𝑐∕𝑏 . So the area of the triangle is

#include<iostream> #include<cmath> using namespace std; double areaTriangle(double a, double b, double c){ return fabs((c*c) / (2*a*b)); } main() { double a = -2, b = 4, c = 3; cout << "Area: " << areaTriangle(a, b, c); }

Area: 0.5625

Advertisements