DECLARE
n NUMBER(3);
m NUMBER(3);
BEGIN
dbms_output.Put_line('The prime numbers between 1 and 100 are:');
dbms_output.new_line;
n := 2;
LOOP
m := 2;
LOOP
EXIT WHEN( ( MOD(n, m) = 0 )
OR ( m = n ) );
m := m + 1;
END LOOP;
IF( m = n )THEN
dbms_output.Put(n||' ');
END IF;
n := n + 1;
exit WHEN n = 100;
END LOOP;
dbms_output.new_line;
END;
Comments
Leave a comment