Senin, 08 Desember 2014

Perulangan : Menampilkan bilangan prima 1 - 20 dengan For - to - do

TRANSLASI KE BAHASA PASCAL

==============================
uses crt;
var
a,b,c:integer;
begin
clrscr;
for a:=1 to 20 do
begin;
c:=0;
     for b:=1 to a do
     begin;
     if a mod b=0 then
     c:=c+1;
     end;
     if c=2 then
     begin;
     write(a,' ');
     end;
end;
readln;
end.