Kamis, 05 Januari 2012
METODE TABEL (PASCAL)
uses crt;
var
a,b,h,x,x1,x2,x3,fx,fx2,fx1,fx3:real;
i,N:integer;
an:char;
begin
clrscr;
write('nilai a='); readln(a);
write('nilai b='); readln(b);
write('nilai N='); readln(N);
writeln('=======================================');
writeln('i x fx fx2 ');
writeln('=======================================');
i:=0;
while(i<=N) do
begin
write(i:2);
h:=(b-a)/N;
x1:=x;
x:=a+(i*h);
fx:=(x+exp(x));
write(x:10:6,'',fx:10:6);
i:=i+1;
if i>0 then
fx2:=fx*fx1;
fx1:=fx;
if i>1 then
writeln(fx2:10:6)
else
writeln;
if fx2<0 then
begin
x2:=x1;
x3:=x;
fx3:=fx2;
end;
end;
writeln('===============================================');
writeln('iterasi ke:',i);
writeln('nilai a:',x2);
writeln('nilai b:',x3);
writeln('nilai fx(n)*fx(n-1):',fx3);
writeln;
writeln;
writeln('=====================terima kasih================');
writeln;
writeln('***********************by_ariez********05/01/2012');
readln(an);
end.
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar