Kamis, 03 November 2011

Program KPK Pascal

program KPK;
uses wincrt;
var a,b,c,d:longint;
begin clrscr;
writeln('PROGRAM MENENTUKAN KPK');
write('ketikkan bilangan ke-1: '); readln(a);
write('ketikkan bilangan ke-2: '); readln(b);
write('ketikkan bilangan ke-3: '); readln(c);
for d:=c to (a*b*c) do
begin
  if (d mod a=0) and (d mod b=0) and(d mod c=0) then
  begin
    writeln('KPK dari ',a:4,',',b:4,' dan ',c:4,' adalah ',d:7);
    d:=a*b*c;
  end;
end;
readln
end.

0 komentar:

Posting Komentar

Related Posts Plugin for WordPress, Blogger...

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | JCPenney Coupons