Three sides of one and three sides of another triangle are given. Determine whether these triangles
Three sides of one and three sides of another triangle are given. Determine whether these triangles will be of equal size, i.e. whether they have equal areas. in the pascal system
Areas in the program are calculated according to Heron’s formula.
program area1;
var a, b, c, p, s1, s2: real // a, b, c – sides of a triangle, p – semiperimeter,
// s1, s2 – areas of triangles;
begin
for i: integer: = 1 to 2 do
begin
writeln (‘Enter the lengths of the three sides of the first triangle’);
read (a, b, c);
p: = (a + b + c) / 2;
s1: = sqrt (p * (p – a) * (p – b) * (p – c));
end
writeln (‘Enter the lengths of the three sides of the second triangle’);
read (a, b, c);
p: = (a + b + c) / 2;
s2: = sqrt (p * (p – a) * (p – b) * (p – c));
if s1 = s2 then writeln (‘The areas of the triangles are equal’) else
writeln (‘The areas of the triangles are different’)
end.