Sabtu, 23 Mei 2015

pascal FPB BIASA

program FPB_BIASA;

 uses crt;
        var a,b,x,y,z:integer;

          begin
           clrscr;
                 write('Inputkan bilangan pertama '); readln(a);
                 write('Inputkan bilangan kedua '); readln(b);
                        x:=0;
                        y:=0;
                        for z:=a downto 1 do
                         begin
                         if ((a mod z=0) and (b mod z=0)) then
                          begin
                           x:=x+1;
                           if x=1 then
                            begin
                             writeln('FPB-nya adalah ',z);
                            end;
                          end;
                         end;
                 readln;
           end.

Tidak ada komentar:

Posting Komentar