Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class TriangleArea {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- double firstX = input.nextDouble();
- double firstY = input.nextDouble();
- double secondX = input.nextDouble();
- double secondY = input.nextDouble();
- double thirdX = input.nextDouble();
- double thirdY = input.nextDouble();
- double area = (firstX*(secondY-thirdY) + secondX*(thirdY-firstY) + thirdX*(firstY-secondY))/2;
- System.out.println(Math.abs(area));
- input.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement