Check out the Pastebin Gadgets Shop. We have thousands of fun, geeky & affordable gadgets on sale :-)Want more features on Pastebin? Sign Up, it's FREE!
tweet

# Contoh Program Pascal (Mencari Akar Persamaan Kuadrat)

By: Polma on Nov 2nd, 2013  |  syntax: Pascal  |  size: 0.89 KB  |  views: 145  |  expires: Never
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
2. Uses crt;
3.
5. Var A,B,C:integer;
6. D,X1,X2:real;
7. ab:char;
8.
9. Begin
11.  clrscr;
12.  writeln('Polma Saut Martua Sihotang');
13.  writeln('118130023 / IK-37-01');
14.  writeln('==========================');
15.  writeln;
16.  writeln ('Ax2 + Bx + C = 0');
17.  writeln;
21.  writeln;
22.
23.  D:=sqr(B)-(4*A*C);
24.  if (D>0) then
25.   begin
26.    X1:=(-B+sqrt(D))/2*A;
27.    X2:=(-B-sqrt(D))/2*A;
28.    writeln('X1= ',X1:4:1);
29.    writeln('X2= ',X2:4:1);
30.   end
31.  else
32.  if (D=0) then
33.   begin
34.    X1:=-B/(2*A);
35.    writeln('X1=X2=',X1:4:1);
36.   end
37.  else
38.   writeln('Akar Imajiner!');
39.   writeln('Apakah anda ingin mengulang ? (Y/N) : '); readln(ab);
40.   if (ab='y') or (ab='Y') then goto menu
41.   else if (ab='n') or (ab='N') then
42.    begin
43.     exit;
44.    end;