penyederhanaan pecahan

June 24, 2008 at 7:04 am | Posted in Informatic | 2 Comments

penyederhanaan pecahan using pascal. exp: 9/3 = 1/3, dst..

program sederhana;

uses wincrt;

var r:integer;

atas,bawah,gcd,m,n: integer;

sdratas,sdrbawah:integer;

begin

write (‘masukkan bilangan atas: ‘);

readln (atas);

write (‘masukkan bilangan bawah: ‘);

readln (bawah);

writeln (atas,’/’,bawah);

if atas>bawah then

begin

m:=atas;

n:=bawah;

end

else

begin

m:=bawah;

n:=atas;

end;

repeat

r := m mod n;

if r=0 then

gcd := n

else

m:=n;

n:=r;

until r=0;

sdratas:=atas div gcd;

sdrbawah :=bawah div gcd;

{write (gcd);}

writeln;

writeln (‘********************’);

writeln (‘hasil penyederhanaan’);

writeln (‘********************’);

writeln;

write (sdratas,’/’,sdrbawah);

end.

2 Comments »

RSS feed for comments on this post. TrackBack URI

  1. Loh!!!! mana Pecahannya?????

  2. wow, awesome
    Thank you…


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

Blog at WordPress.com.
Entries and comments feeds.

%d bloggers like this: