program diskriminan

program deskrimin ;

uses wincrt;

var a,b,c,d,x1,x2,z1,z2 : real;

begin

writeln (‘masukkan nilai a : ‘);readln (a);

writeln (‘masukkan nilai b : ‘);readln (b);

writeln (‘masukkan nilai c : ‘);readln (c);

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

if a=0 then write (‘bukan persamaan kuadrat’) else

if d=0 then

begin

x1:=-b/2*a;

writeln (‘akar-akarnya sama,yaitu x1=x2’,x1:2:2);

end else

if d>0 then

begin

x1:=(-b+sqrt(d))/(2*a) ;

x2:=(-b-sqrt(d))/(2*a);

writeln (‘x1’,x1:2:2);

writeln (‘x2’,x2:2:2);

end else

if d<0 then

begin

writeln(‘akar-akarnya imajiner’);

end;

end.

Iklan

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Foto Google+

You are commenting using your Google+ account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s

%d blogger menyukai ini: