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 / karthikeyan murugesan

hi u can try this one for prime number and generation ::
#include<stdio.h>
void main()
{
int n,i=1,j,c;
scanf("%d",&n);
while(i<=n)
{
c=0;
for(j=1;j<=i;j++)
{
if(i%j==0)
c++;
}
if(c==2)
{
printf("%d",i);
i++;
}
}
getch();
}

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Tell me when is a void pointer used?

1102


What is malloc calloc and realloc in c?

1215


Explain how can you avoid including a header more than once?

1040


Why we write conio h in c?

964


What is wrong with this statement? Myname = 'robin';

1263


What's a good way to check for "close enough" floating-point equality?

1094


Is it better to bitshift a value than to multiply by 2?

1049


write a c program to calculate sum of digits till it reduces to a single digit using recursion

3245


What is union and structure?

1039


What is a 'null pointer assignment' error?

1161


Explain what are binary trees?

1021


i want to know the procedure of qualcomm for getting a job through offcampus

2409


What is a program flowchart and explain how does it help in writing a program?

1225


What is huge pointer in c?

1022


How do you redirect a standard stream?

1050