Skip to content

Menghitung nilai Sin dengan sudut radian

October 20, 2009

Langsung aja praktekin y…

program sin(x);
uses crt;
const pi = 3.14;
var
x,rad,p1,tot : real;
n,i,faktor,p2,j : integer;
tanda : byte;

begin
clrscr;
writeln(‘ Menentukan nilai sin(x)’);
write(‘Nilai x = ‘); readln(x);
write(‘Masukkan pangkat = ‘); readln(n);
rad := pi*x/180;
i := 1;
tanda := 1;
while i <= n do
begin
p1 := exp(i*ln(rad));
faktor := 1;
for j := 1 to i do
faktor := faktor *j;
p2 := faktor;
tot := tot + (tanda*p1/p2);
tanda := (-1)*tanda;
i := i+2;
end;
writeln(‘Sin(‘,x:5:2,’) = ‘,tot:5:2);
readln;
end.

Klo ada pertanyaan langsung di komen…
🙂

One Comment
  1. Anonymous permalink

    ayaankkkkk……

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: