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

Explain how many levels deep can include files be nested?

1077


A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none

1249


disply the following menu 1.Disply 2.Copy 3.Append; as per the menu do the file operations 4.Exit

2076


What is int main () in c?

1091


Where static variables are stored in memory in c?

1003


Why c is called object oriented language?

1072


How can a process change an environment variable in its caller?

1190


What is the heap?

1221


What is call by reference in functions?

1455


Is c a great language, or what?

1123


What is main () in c?

1075


How do we print only part of a string in c?

1030


Is there a way to jump out of a function or functions?

1104


What are pointers really good for, anyway?

1066


What is the purpose of void pointer?

1036