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

Answer Posted / don

#include<stdio.h>
#include<conio.h>

main()
{
int i, p, q;
int count;
printf("Enter lower Limit: ");
scanf("%d",&p);
printf("Enter Upper Limit: ");
scanf("%d",&q);
i=p;
while(i<=q)
{
for(count=2; count<i; count++)
{
if(i%count == 0)
goto line;
else
continue;
}
printf("%d ",i);
line: i++;
}

getch();
}

Is This Answer Correct ?    6 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is table lookup in c?

598


Explain c preprocessor?

650


How can I delete a file?

598


What is a program?

628


How can I manipulate individual bits?

579






What are the advantages of using Unions?

624


Can the “if” function be used in comparing strings?

566


What is wrong with this statement? Myname = 'robin';

778


typedef struct{ char *; nodeptr next; } * nodeptr ; What does nodeptr stand for?

1040


What is function pointer c?

568


What are runtime error?

602


What is c language & why it is used?

554


Can you please explain the difference between malloc() and calloc() function?

586


Do you know the use of 'auto' keyword?

634


Write a function expand(s1,s2) that expands shorthand notations like a-z in the string s1 into the equivalent complete list abc...xyz in s2 . Allow for letters of either case and digits, and be prepared to handle cases like a-b-c and a-z0-9 and -a-z. z-a:zyx......ba -1-6-:-123456- 1-9-1:123456789987654321 a-R-L:a-R...L a-b-c:abbc

5027