- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHPPhysics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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