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

What is extern variable in c with example?

551


What are linked lists in c?

653


Describe the difference between = and == symbols in c programming?

786


I just typed in this program, and it is acting strangely. Can you see anything wrong with it?

569


What are structure members?

605






what is bit rate & baud rate? plz give wave forms

1529


What is cohesion in c?

549


A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers

659


How important is structure in life?

600


Explain what is a 'locale'?

596


How can you invoke another program from within a C program?

624


a construct the"else" part of "if" statement contains anoth "if else" statement is called a) if-else b) else-if-else c) if-else-if-else d) chain if/if-else-if

712


What is the difference between ā€˜gā€™ and ā€œgā€ in C?

2696


What is c language used for?

567


What is wrong with this program statement?

612