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 the program for prime numbers?

Answer Posted / sham

int main()
{
int i,j,n,f=0;
printf("Enter the length\n");
scanf("%d",&n);
for(i=2;i<=n;i++)
{
for(j=2;j<i;j++)
{
if((i%j)==0)
{
f=1;
break;
}
f=0;
}
if(f==0)
printf("%d ",i);
}
}

Is This Answer Correct ?    180 Yes 107 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a buffer in c?

946


What are the main characteristics of c language describe the structure of ac program?

1145


the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none

999


Is there a way to switch on strings?

1027


how should functions be apportioned among source files?

1055


What does it mean when a pointer is used in an if statement?

1060


if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0

1881


What is meant by preprocessor in c?

945


Is null always defined as 0(zero)?

1041


When should the register modifier be used? Does it really help?

917


What is the difference between a string and an array?

1152


What happens if you free a pointer twice?

1025


write a program to copy the string using switch case?

2842


What is ctrl c called?

1001


How can you determine the size of an allocated portion of memory?

1235