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

Can a local variable be volatile in c?

573


Tell me when would you use a pointer to a function?

603


How variables are declared in c?

569


Whats s or c mean?

591


Is multithreading possible in c?

562






What is the benefit of using #define to declare a constant?

601


Explain how do you print an address?

652


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

2030


What is the condition that is applied with ?: Operator?

656


How can you pass an array to a function by value?

597


Explain what is a pragma?

587


Write an efficient algo and C code to shuffle a pack of cards.. this one was a feedback process until we came up with one with no extra storage.

655


Explain what is the benefit of using #define to declare a constant?

604


How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same

647


When a c file is executed there are many files that are automatically opened what are they files?

589