Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Is null always equal to 0(zero)?

1031


Why is c called a mid-level programming language?

1196


How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?

16757


What is the use of define in c?

1055


Explain what is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?

1090


When c language was developed?

1058


What is variable initialization and why is it important?

1248


What does p mean in physics?

1034


What is static and volatile in c?

1219


Explain the difference between strcpy() and memcpy() function?

993


Is c still relevant?

1076


Explain what is output redirection?

1186


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....

1967


Difference between Shallow copy and Deep copy?

2018


A collection of functions,calls,subroutines or other data a) library b) header files c) set of files d) textfiles

1173