Write a program to print all the prime numbers with in the
given range

Answer Posted / chavidi

void prime(int a,int b)
{
int i,j,c
for(i=a;i<=b;i++)
{
c=0;
for(j=1;j<=a;j++)
{
if(a%j==0)
{
c++;
}
}
if(c==2)
printf(i);
}
}

Is This Answer Correct ?    8 Yes 14 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

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

607


Q.1 write aprogram to stack using linklist o insert 40 items? Q.2 write a program to implement circular queue with help of linklist?

1600


What is a node in c?

550


Differentiate fundamental data types and derived data types in C.

618


Why is this loop always executing once?

617






why use functions a) writing functions avoids rewriting the same code over and over b) using functions it becomes easier to write programs and keep track of what they are doing c) a & b d) none of the above

654


Is that possible to store 32768 in an int data type variable?

692


How to create struct variables?

592


What are the various types of control structures in programming?

628


write a programming in c to find the sum of all elements in an array through function.

1708


What is a ternary operator in c?

652


write a program to rearrange the array such way that all even elements should come first and next come odd

1762


the statement while(i) puts the entire logic in loop. this loop is called a) indefinite loop b) definite loop c) loop syntax wrong d) none of the above

606


What is selection sort in c?

611


Write a code to determine the total number of stops an elevator would take to serve N number of people.

728