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

Explain heap and queue.

1087


What is the most efficient way to count the number of bits which are set in an integer?

1053


What is the equivalent code of the following statement in WHILE LOOP format?

1305


What is the difference between printf and scanf in c?

1354


What are the different data types in C?

1203


What is difference between structure and union in c?

989


What is the purpose of 'register' keyword in c language?

1026


Difference between exit() and _exit() function?

1134


What are the features of c languages?

1101


What is FIFO?

1706


How can I determine whether a machines byte order is big-endian or little-endian?

1059


Do you know what are bitwise shift operators in c programming?

1103


Where local variables are stored in c?

1006


shorting algorithmS

2255


What is use of bit field?

1297