Advertisement
n_stefanov

Ex2_TriangleArea

May 11th, 2014
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.43 KB | None | 0 0
  1. package javaSyntax;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Ex2_TriangleArea {
  6.     public static void main(String[] args) {
  7.         Scanner in = new Scanner(System.in);
  8.         int aX = in.nextInt();
  9.         int aY = in.nextInt();
  10.        
  11.         int bX = in.nextInt();
  12.         int bY = in.nextInt();
  13.        
  14.         int cX = in.nextInt();
  15.         int cY = in.nextInt();
  16.        
  17.         int result = (aX*(bY-cY)+ bX*(cY-aY)+cX*(aY-bY))/2;
  18.        
  19.         System.out.println(Math.abs(result));
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement