static void Main(string[] args) { Krug k = new Krug(5); Treugolnik t = new Treugolnik(4, 4, 5); Console.WriteLine(SAll.S(k)); Console.WriteLine(SAll.S(t)); Console.WriteLine(Treugolnik.TruePrTreugolnik(t)); }
public static bool TruePrTreugolnik(Treugolnik t) { double[] tr = { t.A, t.B, t.C }; Array.Sort(tr); if ((tr[0] * tr[0] + tr[1] * tr[1]) == tr[2] * tr[2]) { return(true); } else { return(false); } }
public static double S(Treugolnik t) { double p = (t.A + t.B + t.C) / 2; return(Math.Sqrt(p * (p - t.A) * (p - t.B) * (p - t.C))); }