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
What is bash c?
What is a pointer variable in c language?
Did c have any year 2000 problems?
Explain how does free() know explain how much memory to release?
Which one to choose from 'initialization lists' or 'assignment', for the use in the constructor?
Write a program to compute the similarity between two strings - The program should get the two strings as input - Then it will output one single number which is the percentage of similarity between the two strings
formula to convert 2500mmh2o into m3/hr
List some basic data types in c?
What are runtime error?
Are pointers integers in c?
What are formal parameters?
write a c programming using command line argument,demonstrate set operation(eg;union,intersection,difference) example output is c:>setop 12 34 45 1 union 34 42 66 c:>setop 12 34 1 42 66 c:>setop 12 34 diff 12 56 67 78 setop 12 34
Is return a keyword in c?
Give the rules for variable declaration?
What is array of structure in c programming?