fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5.  
  6. class Ideone
  7. {
  8. public static void main (String[] args)
  9. {
  10. double xA, yA, xB, yB, xC, yC, S; // описание переменных
  11. Scanner sc = new Scanner(System.in);
  12. System.out.println("Coordinates of point A:\n"); //ввод координат вершин треугольника
  13. xA = sc.nextDouble();
  14. yA = sc.nextDouble();
  15. System.out.println("Coordinates of point B:\n");
  16. xB = sc.nextDouble();
  17. yB = sc.nextDouble();
  18. System.out.println("Coordinates of point C:\n");
  19. xC = sc.nextDouble();
  20. yC = sc.nextDouble();
  21. S=Math.abs((xB-xA)*(yC-yA)-(xC-xA)*(yB-yA))/2.0; //вычисление площади
  22. System.out.printf("Square=%f",S);
  23. }
  24. }
Success #stdin #stdout 0.15s 321344KB
stdin
0 0 0 4 5 0
stdout
Coordinates of point A:

Coordinates of point B:

Coordinates of point C:

Square=10.000000