Anda di halaman 1dari 1

program luaSsegitiga; uses wincrt; var xa,xb,xc,ya,yb,yc:real; AB,AC,BC,S,L,Z,t:real; begin writeln('Program Menghitung Luas Segitiga ABC'); writeln('Menghitung luas

jika diketahuikoordinat A,B, & C'); writeln; writeln; writeln('Masukkan koordinat titik A, B, dan C'); write('A( ');write(',');write(' )'); gotoXY(3,6);read(xa); gotoXY(7, 6);read(ya); writeln; write('B( ');write(',');write(' )'); gotoXY(3,8);read(xb); gotoXY(7, 8);read(yb); writeln; write('C( ');write(',');write(' )'); gotoXY(3,10);read(xc); gotoXY(7 ,10);read(yc); Z:=(yc-ya)*(xb-xa)+(xa-xc)*(yb-ya); if Z= 0 then begin writeln ; writeln('Koordinat yang Anda masukkan TIDAK membentuk SEGITIGA'); writeln; writeln('Sehingga tidak perlu dicari luasnya'); end else begin AB:=sqrt( (sqr(xa-xb)+sqr(ya-yb))); AC:=sqrt( (sqr(xa-xc)+sqr(ya-yc))); BC:=sqrt( (sqr(xb-xc)+sqr(yb-yc))); t:=AC*sqrt(1-sqr(((sqr(AB)+sqr(AC)-sqr(BC))/2*AB*AC))); L:=AB*t/2; writeln; write('Luas segitiga ABC adalah L = ');write(L); end End.