**Objective** – Given three vertices coordinates or (X, Y) coordinates, write a program to find the area of a triangle.

**Example**:

**Approach**:

Given the coordinates of the three vertices of any triangle are (X1, Y1), (X2, Y2) and (X3, Y3)

**Java Code**:

public class AreaOfTriangleCoordinates { | |

public static void printArea(double [] X, double [] Y){ | |

//find area of triangle | |

double area = Math.abs(X[0]*(Y[1]–Y[2]) + X[1]*(Y[2]–Y[0]) + X[2]*(Y[0]–Y[1]))/2; | |

System.out.println("Area of Triangle: " + area); | |

} | |

public static void main(String[] args) { | |

double [] x_coordinates = {1,2,5}; | |

double [] y_coordinates = {0, 6, 10}; | |

printArea(x_coordinates, y_coordinates); | |

} | |

} |

**Output**:

Area of Triangle: 7.0

The formula in the approach is wrong.