Program AkarPersamaanKuadrat;

Program AkarPersamaanKuadrat;
uses crt;
var x1,x2,a,b,c,D : real;
begin
clrscr;
write(‘Nilai a : ‘);
readln(a);
write(‘Nilai b : ‘);
readln(b);
write(‘Nilai c : ‘);
readln(c);

D := b*b-4*a*c;

if D < 0 then
writeln(‘Akarnya imajiner’)
else
if D = 0 then
begin
x1 := -b / (2* a);
x2 := x1;
Writeln(‘Akar Persamaan Kuadrat Anda : X1 = X2 = ‘,x1:8:2);
end
else
begin
x1 := (-b + sqrt(D))/ (2 * a);
X2 := (-b – sqrt(D))/ (2 * a);
Writeln(‘Akar Persamaan Kuadrat Anda : X1 = ‘,x1:8:2);
Writeln(‘                              X2 = ‘,x2:8:2);
end;
readln;
end.

Leave a Reply

Please log in using one of these methods to post your comment:

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

%d bloggers like this: