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

Do you know null pointer?

785


Is c language still used?

741


What is new line escape sequence?

1039


How can I determine whether a machines byte order is big-endian or little-endian?

838


What is the difference between array and structure in c?

807


Are there any problems with performing mathematical operations on different variable types?

816


Where are local variables stored in c?

778


What is #include stdio h and #include conio h?

775


How are portions of a program disabled in demo versions?

1019


Why flag is used in c?

872


Why is C language being considered a middle level language?

857


how could explain about job profile

1662


What are the advantages of the functions?

878


What is structure data type in c?

762


What is huge pointer in c?

771