abstract class Figure
{
public float P(params float[] znach)
{
float summ = 0;
for (int i = 0; i < znach.Length; i++)
{
summ += znach[i];
}
return summ;
}
public abstract float S();
}
class Triangle : Figure
{
public float s1 { get; set; }
public float s2 { get; set; }
public float s3 { get; set; }
public Triangle(float s1, float s2, float s3)
{
this.s1 = s1;
this.s2 = s2;
this.s3 = s3;
}
public override float S()
{
float p = (s1 + s2 + s3) / 2;
float s = p * (p - this.s1) * (p - this.s2) * (p - this.s3);
return (float) Math.Sqrt(s);
}
}