Minggu, 17 Januari 2010

Source Code Bilangan Prima di Pascal

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.

0 comments:

Posting Komentar

Twitter Delicious Facebook Digg Stumbleupon Favorites More

Enter your email address to subscribe:

Delivered by FeedBurner

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | SharePoint Demo