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
Can a pointer be null?
What is output redirection?
What is ponter?
how many key words availabel in c a) 28 b) 31 c) 32
Can you please explain the difference between syntax vs logical error?
How do you write a program which produces its own source code as output?
What are c preprocessors?
What does dm mean sexually?
Which is best linux os?
How macro execution is faster than function ?
Write a program that accept anumber in words
Explain what are binary trees?
Why should I use standard library functions instead of writing my own?
Is exit(status) truly equivalent to returning the same status from main?
What is the significance of scope resolution operator?