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
Is linux written in c?
What is dangling pointer in c?
Why doesnt this code work?
What is c language in simple words?
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
What is infinite loop?
What does *p++ do? What does it point to?
Explain is it valid to address one element beyond the end of an array?
What are the types of unary operators?
What the advantages of using Unions?
What is a good data structure to use for storing lines of text?
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.
What is New modifiers?
Using functions, write a program that multiplies two arrays. Use the following functions: - Function ReadArray - Function MultiplyArrays - Function DisplayArrays
What is the difference between %d and %i?