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 / ankish jaiswal

#include<stdio.h>
#include<conio.h>
int main()
{
int r,a,b,c=0;
printf("Enter the n value:");
scanf("%d",&r);
a=0;
while(a<=r)
{
b=1;c=0;
while(b<=a)
{
if(a%b==0)
c=c+1;
b++;
}
if(c==2)
printf("%d ",a);
a++;
}
getch();
return 0;
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is unary operator?

1176


What is getche() function?

1088


Who developed c language?

1150


Why do we need functions in c?

1082


What are the advantages of c preprocessor?

1315


Why is c not oop?

1038


What does double pointer mean in c?

1256


the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?

1040


write a program to display all prime numbers

2016


What is selection sort in c?

1176


Why c is called a mid level programming language?

1110


Is it possible to initialize a variable at the time it was declared?

1257


Is it cc or c in a letter?

1077


What are the key features in c programming language?

1126


What tq means in chat?

1172