set serveroutput on;
Declare
i number(4);
j number(4);
prime number:=1;
count number:=0;
Begin
i:=1;
while i<=100
loop
prime:=1;
j:=2;
while j<=i/2
loop
if i mod j=0 then
prime:=0;
end if;
j:=j+1;
end loop;
if prime=1 then
count:=count+1;
end if;
i:=i+1;
end loop;
dbms_output.put_line('counting the prime number is = '||count);
End;
/
Declare
i number(4);
j number(4);
prime number:=1;
count number:=0;
Begin
i:=1;
while i<=100
loop
prime:=1;
j:=2;
while j<=i/2
loop
if i mod j=0 then
prime:=0;
end if;
j:=j+1;
end loop;
if prime=1 then
count:=count+1;
end if;
i:=i+1;
end loop;
dbms_output.put_line('counting the prime number is = '||count);
End;
/
No comments:
Post a Comment