write the program for prime numbers?

Answer Posted / biswa

void main()
{
int i=2;
int count=0;
int n;
printf("enter a no");
scanf("%d",&n);
for(i=2;i<n/2;i++)
{
if(n%i==0)
{
count++;
}
if(count>1)
{
prinf("prime");
else
printf("not prime");
}

Is This Answer Correct ?    311 Yes 310 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

a sequence of bytes with one to one corrspondence to those in the external device a) sequential addressing b) address c) byte code d) none

718


What is the use of bit field?

636


Write a program to implement queue.

665


Which is better oop or procedural?

629


what are # pragma staments?

1624






In this problem you are to write a program that will cut some number of prime numbers from the list of prime numbers between 1 and N.Your program will read in a number N; determine the list of prime numbers between 1 and N; and print the C*2 prime numbers from the center of the list if there are an even number of prime numbers or (C*2)-1 prime numbers from the center of the list if there are an odd number of prime numbers in the list.

1375


write a c program to print the next of a particular no without using the arithmetic operator or looping statements?

3181


List the difference between a While & Do While loops?

632


What are the output(s) for the following ? #include char *f() {char *s=malloc(8); strcpy(s,"goodbye")} main() { char *f(); printf("%c",*f()='A'); }

696


Explain how can you tell whether two strings are the same?

580


What will be your course of action for a push operation?

663


Why void main is used in c?

559


What kind of structure is a house?

552


What is the purpose of macro in C language?

659


What is the purpose of the preprocessor directive error?

679