Laporan Akhir Praktikum Pascal 20120412

Tinggal di copy-paste aja ke notepad++ save as *.pas terus running deh.

program regula_falsi;
uses crt;
var a, b, c, d, fa, fb, fc, cl, akar: real;
const e = 0.001;
begin
clrscr();
writeln(‘Perhitungan Akar Persamaan F(x) = x + cos (x)’);
write(‘Masukkan Nilai A=’);readln(a);
write(‘Masukkan Nilai B=’);readln(b);
repeat
cl := (2 * b) / 2;
fa := a + cos (a);
fb := b + cos (b);
c := b – (fb * ( (b – a) / (fb – fa) ) );
fc := c + cos (c);
d := (c – cl) / c;
if d < e then akar := c;
if fa * fc < 0 then b := c else a := c;
cl := c;
until d < e;
writeln('Maka Akar Persamaannya adalah = ', akar:2:3);
readln;
end.

Sekian.

Posted from WordPress for Android

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

%d bloggers like this: