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
What is scanf () in c?
What is signed and unsigned?
What is preprocessor with example?
How many levels deep can include files be nested?
What is function prototype?
Write the test cases for checking a variable having value in range -10.0 to +10.0?
Linked lists -- can you tell me how to check whether a linked list is circular?
program to convert a integer to string in c language'
Why is a semicolon (;) put at the end of every program statement?
What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?
Compare array data type to pointer data type
What is page thrashing?
What does 3 mean in texting?
a parameter passed between a calling program and a called program a) variable b) constant c) argument d) all of the above
What is the importance of c in your views?