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 indirection in c?
Is c weakly typed?
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
What is the difference between arrays and pointers?
Explain null pointer.
What is the benefit of using const for declaring constants?
What is cohesion in c?
How can you draw circles in C?
What does %p mean c?
What are preprocessor directives in c?
Are comments included during the compilation stage and placed in the EXE file as well?
C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions
Why we write conio h in c?
What is pass by reference in c?
Which header file should you include if you are to develop a function which can accept variable number of arguments?