stefan1919

Cortesian system if a triangle

Jul 26th, 2015
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.30 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading;
  6.  
  7. namespace novo2
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int aX = int.Parse(Console.ReadLine());
  14.             int aY = int.Parse(Console.ReadLine());
  15.             int bX = int.Parse(Console.ReadLine());
  16.             int bY = int.Parse(Console.ReadLine());
  17.             int cX = int.Parse(Console.ReadLine());
  18.             int cY = int.Parse(Console.ReadLine());
  19.             string n = "No";
  20.             string f = "Yes";
  21.             double a = Math.Sqrt(Math.Pow((cX - bX), 2) - Math.Pow((cY - bY), 2));
  22.             double b = Math.Sqrt(Math.Pow((cX - aX), 2) - Math.Pow((cY - aY), 2));
  23.             double c = (Math.Sqrt(Math.Pow((bX - aX), 2) + Math.Pow((bY - aY), 2)));
  24.             float area = aX * bY + bX * cY + cX * aY - bX * aY - cX * bY - aX * cY;
  25.             if (area == 0)
  26.             {
  27.                 Console.WriteLine(n);
  28.             Console.WriteLine("{0:0.00}", c);
  29.             }
  30.             else
  31.             {
  32.                 float triangle = area / 2;
  33.                 Console.WriteLine(f);
  34.                 Console.WriteLine("{0:0.00}", triangle);
  35.             }
  36.  
  37.             }
  38.                 }
  39.                  }
Advertisement
Add Comment
Please, Sign In to add comment