Program segitiga;
uses wincrt;
type point=record
absis:integer;
ordinat:integer;
end;
var
titik:array [1..3] of point;
i,alas,tinggi:integer;
jawaban:real;
begin
writeln(' *(3) ');
writeln(' *** ');
writeln('(1)******(2)');
writeln('masukan nilai titik 1, 2, 3 : ');
writeln;
for i := 1 to 3 do
begin
writeln('titik ',i);
write('nilai absis = ');readln(titik[i].absis);
write('nilai ordinat = ');readln(titik[i].ordinat);
end;
if (titik[1].ordinat=0) and( titik[2].ordinat=0) then
begin
alas:=titik[2].absis-titik[1].absis;
tinggi:=titik[3].ordinat;
jawaban:=((0.5*alas)*tinggi);
writeln('alas = ',alas);
writeln('tinggi = ',tinggi);
writeln('luas = ',jawaban:0:2);
end
else
writeln('titik 1 dan 2 tidak menempel di garis X');
end.
No comments:
Post a Comment