Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Area of triangle formed by the axes of co-ordinates and a given straight line?
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

Example
#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);
}
Output
Area: 0.5625
Advertisements