program jumlahBilanganPrima;
uses crt;
var a,b,c,d,e,jml : integer;
begin
clrscr;
write('batas terendah : '); readln(a);
write('batas tertinggi : '); readln(b);
if a>2 then begin
jml:=0; a:=a;
end else begin
jml:=1; a:=3;
end;
if a>b then
begin
write('Anda salah input'); readln;
exit;
end else
for a:=a to b do begin
for c:=2 to a-1 do begin
if a mod c = 0 then begin
d:=a;
end else begin
e:=a;
end;
end;
if a=d then begin
c:=a-1;
end else begin
write(e:4);
jml:=jml+1;
end;
end;
writeln;
write('jumlah : ',jml);
readln;
end.
Kamis, 03 November 2011
Program Bilangan Prima Pascal
09.30
Guardian
No comments
0 komentar:
Posting Komentar