program triangle;
var x1,x2,x3,y1,y2,y3,p:real;
function distance(a,b,c,d:real):real;
begin
distance:=sqrt(sqr(a-b)+sqr(c-d))
end;
begin cls;
writeln('Введите коорджинаты вершин треугольника ');
write('x1 = '); readln(x1);
write('y1 = '); readln(y1);
write('x2 = '); readln(x2);
write('y2 = '); readln(y2);
write('x3 = '); readln(x3);
write('y3 = '); readln(y3);
p:=distance(x1,y1,x2,y2)+distance(x2,y2,x3,y3)+distance(x3,y3,x1,y1);
writeln('Периметр треугольника равен ',p)
end.
_______________________________________________
procedure distance(a,b,c,d:real);
p:=p+sqrt(sqr(a-b)+sqr(c-d))
p:=0;
distance(x1,y1,x2,y2);
distance(x2,y2,x3,y3);
distance(x3,y3,x1,y1);
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
program triangle;
var x1,x2,x3,y1,y2,y3,p:real;
function distance(a,b,c,d:real):real;
begin
distance:=sqrt(sqr(a-b)+sqr(c-d))
end;
begin cls;
writeln('Введите коорджинаты вершин треугольника ');
write('x1 = '); readln(x1);
write('y1 = '); readln(y1);
write('x2 = '); readln(x2);
write('y2 = '); readln(y2);
write('x3 = '); readln(x3);
write('y3 = '); readln(y3);
p:=distance(x1,y1,x2,y2)+distance(x2,y2,x3,y3)+distance(x3,y3,x1,y1);
writeln('Периметр треугольника равен ',p)
end.
_______________________________________________
program triangle;
var x1,x2,x3,y1,y2,y3,p:real;
procedure distance(a,b,c,d:real);
begin
p:=p+sqrt(sqr(a-b)+sqr(c-d))
end;
begin cls;
writeln('Введите коорджинаты вершин треугольника ');
write('x1 = '); readln(x1);
write('y1 = '); readln(y1);
write('x2 = '); readln(x2);
write('y2 = '); readln(y2);
write('x3 = '); readln(x3);
write('y3 = '); readln(y3);
p:=0;
distance(x1,y1,x2,y2);
distance(x2,y2,x3,y3);
distance(x3,y3,x1,y1);
writeln('Периметр треугольника равен ',p)
end.