program
jumlah_riemann_untuk_fungsi_kuadrat;
uses wincrt;
type
data=
array [1..100] of real;
var
a, b,
c, bb, ba, n, i, Panjang: integer;
sub,
X, t, r, g, jum, p: real;
s:
data;
begin
writeln(' Program Jumlah Riemann untuk Fungsi Kuadrat ');
writeln('Bentuk
Umum Fungsi Kuadrat y = f(x) = ax^2 + bx + c');
writeln;
writeln;
write('masukkan
koefisien x^2: ');read(a);
write('masukkan
koefisien x : ');read(b);
write('Masukkan
koefisien c : ');read(c);
writeln;
write('Fungsi
kuadrat adalah y = ',a,'x^2 + ',b,'x + ',c);
writeln;
write('Batas
bawah interval: ');read(bb);
write('Batas
atas interval : ');read(ba);
writeln;
Panjang:=
(ba - bb);
write('Jadi
panjang interval adalah: ',Panjang);
writeln;
writeln;
write('Banyak
sub interval : ');read(n);
sub:=
(Panjang/n);
write('Panjang
sub interval adalah: ',sub);
writeln;
r:=
bb;
t:= bb
+ sub;
for i:=1 to n do
begin
writeln('Sub interval ke-',i,' antara ',r,' dan ',t);
r:= r + sub;
t:= t + sub;
end;
writeln;
for i:=1 to n do
begin
write('Titik
sampel ke-',i,' = ');read(s[i]);
end;
writeln;
jum:=0;
for i:=1 to n do
begin
g:=
((a * s[i] * s[i]) + (b * s[i]) + c) * sub;
write('Luas
polygon ke-',i,' = ',g);
jum:=jum
+ g;
writeln;
end;
writeln;
write('Jadi luas seluruh polygon = ',jum);
writeln;
end.
No comments:
Post a Comment