Membuat Program Menghitung jarak dengan Turbo Pascal

Program Menghitung_Jarak;
uses crt;
var
    X1,x2,y1,y2:integer;
    d:real;
begin
    writeln(‘Program Menghitung Jarak Titik A dan B’);
    writeln(‘======================================’);
    writeln;
    write(‘Masukan Nilai A (X1):’);readln(x1);
    write(‘Masukan Nilai B (X2):’);readln(x2);
    write(‘Masukan Nilai A (Y2):’);readln(y2);
    write(‘Masukan Nilai B (Y2):’);readln(y2);
    d:=sqrt(sqr(x2-x1)+sqr(y2-y1));
    writeln;
    writeln(‘Jadi Jarak Titik A ke B Adalah:’,d:4:2);
    readln;
end.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s