Program Bilangan_Prima;
uses crt;
var a,b,c,d,e:longint;
begin clrscr;
write('bilangan prima sampai berapa? '); readln(c);
writeln('2':7);
for a:=3 to c do
begin
for b:= 2 to a-1 do
begin
if a mod b = 0 then begin
d:=a ; end else begin e:=a; end;end;
if a=d then
begin
b:= a-1;
end else
writeln(e:7);
end; readln end.
Minggu, 17 Januari 2010
Source Code Bilangan Prima di Pascal
Minggu, Januari 17, 2010
Galiarta
No comments
0 comments:
Posting Komentar