Write a program to print all the prime numbers with in the
given range
Answer Posted / smi
/* Program to print all prime number between a range through
function */
#include
#include
void print_prime(int r1,int r2)
{
int n=0,d=0,j;
clrscr();
for(n=r1;n<=r2;++n)
{
for(j=2;j
{
if(n%j==0)
{
d++;
break;
}
}
if(d==0)
printf("\t%d",n);
d=0;
}
}
void main()
{
int n1=0,n2=0;
printf("\n Enter range1 & range2 =>");
scanf("%d%d",&n1,&n2);
print_prime(n1,n2);
getch();
}
| Is This Answer Correct ? | 26 Yes | 47 No |
Post New Answer View All Answers
Is null always equal to 0(zero)?
Why is c called a mid-level programming language?
How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?
What is the use of define in c?
Explain what is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
When c language was developed?
What is variable initialization and why is it important?
What does p mean in physics?
What is static and volatile in c?
Explain the difference between strcpy() and memcpy() function?
Is c still relevant?
Explain what is output redirection?
i have to apply for the rbi for the post of officers. i need to know abt the entrance questions whether it may be aps or techinical....
Difference between Shallow copy and Deep copy?
A collection of functions,calls,subroutines or other data a) library b) header files c) set of files d) textfiles