Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Zad3
- {
- class Program
- {
- struct Tacka
- {
- int x, y;
- }
- static double Povrsina(Tacka t1, Tacka t2, Tacka t3)
- {
- double a, b, c, p, o, s;
- a = Math.Sqrt(Math.Pow(t1.x - t2.x, 2) + Math.Pow(t1.y - t2.y, 2));
- b = Math.Sqrt(Math.Pow(t1.x - t3.x, 2) + Math.Pow(t1.y - t3.y, 2));
- c = Math.Sqrt(Math.Pow(t3.x - t2.x, 2) + Math.Pow(t3.y - t2.y, 2));
- o = a + b + c;
- s = o / 2;
- p = Math.Sqrt(s * (s - a) * (s - b) * (s - c));
- return p;
- }
- static void Main(string[] args)
- {
- Console.WriteLine("Unesi koordinate tacaka");
- double p;
- Tacka t1, t2, t3;
- t1.x = Convert.ToInt32(Console.ReadLine());
- t1.y = Convert.ToInt32(Console.ReadLine());
- t2.x = Convert.ToInt32(Console.ReadLine());
- t2.y = Convert.ToInt32(Console.ReadLine());
- t3.y = 0;
- t3.x = 0;
- p = Povrsina(t1, t2, t3);
- Console.Write("{0}", p);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement