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
Explain heap and queue.
What is the most efficient way to count the number of bits which are set in an integer?
What is the equivalent code of the following statement in WHILE LOOP format?
What is the difference between printf and scanf in c?
What are the different data types in C?
What is difference between structure and union in c?
What is the purpose of 'register' keyword in c language?
Difference between exit() and _exit() function?
What are the features of c languages?
What is FIFO?
How can I determine whether a machines byte order is big-endian or little-endian?
Do you know what are bitwise shift operators in c programming?
Where local variables are stored in c?
shorting algorithmS
What is use of bit field?