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 scanf () in c?

1177


What is signed and unsigned?

1127


What is preprocessor with example?

1116


How many levels deep can include files be nested?

1188


What is function prototype?

1217


Write the test cases for checking a variable having value in range -10.0 to +10.0?

2372


Linked lists -- can you tell me how to check whether a linked list is circular?

1136


program to convert a integer to string in c language'

2509


Why is a semicolon (;) put at the end of every program statement?

1127


What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?

1487


Compare array data type to pointer data type

1085


What is page thrashing?

1148


What does 3 mean in texting?

1170


a parameter passed between a calling program and a called program a) variable b) constant c) argument d) all of the above

1177


What is the importance of c in your views?

1242