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 the prime numbers from 1 to 100?

Answer Posted / m santhosh

int count=0;
int number=100; //// print Prime no's from 1 to 100
for(int i=1;i<=number;i++)
{
count=0;
for(int j=1;j<=i;j++)
{
if((i%j==0))
{
count++;
}

}
if(count<=2)
{
printf("\nPrime Number = %d",i);

}

}

Is This Answer Correct ?    14 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is indirection in c?

1018


Is c weakly typed?

962


any restrictions have on the number of 'return' statements that may be present in a function. a) no restriction b) only 2 return statements c) only 1 return statements d) none of the above

1093


What is the difference between arrays and pointers?

1064


Explain null pointer.

1035


What is the benefit of using const for declaring constants?

987


What is cohesion in c?

919


How can you draw circles in C?

1097


What does %p mean c?

1016


What are preprocessor directives in c?

1030


Are comments included during the compilation stage and placed in the EXE file as well?

1027


C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions

999


Why we write conio h in c?

963


What is pass by reference in c?

1142


Which header file should you include if you are to develop a function which can accept variable number of arguments?

1317