write the program for prime numbers?

Answer Posted / naveen reddy

This is written in PL/SQL: TO check wether given number is prime or not

DECLARE
i number:=&i;
j number:=2;
ch number:=0;
BEGIN
WHILE(j<=i/2) loop

if mod(i,j)=0 then
dbms_output.put_line('not prime');
ch:=1;
exit ;
else
j:=j+1;
end if;
end loop;

if ch=0 then
dbms_output.put_line('prime number');
end if;
end;

Is This Answer Correct ?    106 Yes 23 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is it possible to have a function as a parameter in another function?

592


if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0

1433


What does volatile do?

555


Explain the properties of union.

603


Is main is a keyword in c?

599






What is the difference between malloc calloc and realloc in c?

641


can we change the default calling convention in c if yes than how.........?

2024


diff between exptected result and requirement?

1590


Where can I get an ansi-compatible lint?

634


what is uses of .net

1264


Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.

694


can any one please explain, how can i access hard disk(physical address)? it is possible by the use of far,near or huge pointer? if yes then please explain......

1398


code for quick sort?

1608


What is NULL pointer?

671


Explain b+ tree?

614