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

Answer Posted / om

void find_primenumber_in_range(int r1,int r2)
{
int i,j;
for(i=r1;i<=r2;i++)
{
for(j=2; j<=(i/2); j++)
if(i%j==0)
break;
if(j== (i/2 +1))
printf("%d\t",i);
}
}

Is This Answer Correct ?    31 Yes 21 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is linux written in c?

603


What is dangling pointer in c?

627


Why doesnt this code work?

620


What is c language in simple words?

598


exit () is used to a) exit () terminates the execution of the program itself b) exit () terminates the execution of the loop c) exit () terminates the execution of the block d) none of the above

667






What is infinite loop?

632


What does *p++ do? What does it point to?

618


Explain is it valid to address one element beyond the end of an array?

739


What are the types of unary operators?

665


What the advantages of using Unions?

675


What is a good data structure to use for storing lines of text?

601


7-Given an index k, return the kth row of the Pascal's triangle. For example, when k = 3, the row is [1,3,3,1]. For reference look at the following standard pascal’s triangle.

2224


What is New modifiers?

674


Using functions, write a program that multiplies two arrays. Use the following functions: - Function ReadArray - Function MultiplyArrays - Function DisplayArrays

1895


What is the difference between %d and %i?

598