Wy22’s Weblog

Just another WordPress.com weblog

Bilangan prima

Bilangan Prima

Nama : Wayan Darsaneni sintak nya :program Bilangan_Prima_Daier;
uses crt;      var
  i,j:integer;
  bil:integer;
  prim:array[0..1000]of integer;
  n:integer;
begin
  clrscr;
  write(’Masukan batas bilangan prima [2..1000] = ‘); readln(n);
  writeln;
  write(’Tampilan Bilangan primanya adalah = ‘);
  for i:=2 to n do
  begin
    prim[i]:=i;
    for j:=2 to i-1 do
    begin
      bil:=(i mod j);
      if bil = 0 then
        prim[i]:=0;
    end;
    if prim[i] <> 0 then
      write(prim[i],’ ‘);
  end;
  readln;
end.
Flowchart dari Program Pascal :

ini flowchartnya

 

Advertisements

No comments yet.

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: