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

How will you find a duplicate number in a array without negating the nos ?

1648


What is a protocol in c?

559


How can you draw circles in C?

625


Explain two-dimensional array.

631


console I/O functions means a) the I/O operations done on disk b) the I/O operations done in all parts c) the input given through keyboard is displayed VDU screen d) none of the above

655






What is "Duff's Device"?

703


why return type of main is not necessary in linux

1706


while initialization of array why we use a[][2] why not a[2][]...?

1868


What is a void pointer? When is a void pointer used?

626


What is action and transformation in spark?

597


in linking some of os executables are linking name some of them

1651


Tell me the use of bit field in c language?

629


When should volatile modifier be used?

556


c program for searching a student details among 10 student details

1655


What does typeof return in c?

639