Write a program to print the prime numbers from 1 to 100?

Answer Posted / deva

int main()
{
int i,j,count=0;

for(i=2;i<100;i++)
{

for( j=2;j<i;j++)
{
if(i%j==0)
count++;

}
if (count==0)
printf("%d\t",i);
count=0;
}

}

Is This Answer Correct ?    22 Yes 37 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How does #define work?

658


What is %lu in c?

693


Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......

1755


Is linux written in c?

607


a parameter passed between a calling program and a called program a) variable b) constant c) argument d) all of the above

667






What is the use of volatile?

618


develop algorithms to add polynomials (i) in one variable

1751


Synonymous with pointer array a) character array b) ragged array c) multiple array d) none

624


When can you use a pointer with a function?

578


What is f'n in math?

627


What would happen to X in this expression: X += 15; (assuming the value of X is 5)

1315


In C programming, how do you insert quote characters (‘ and “) into the output screen?

904


Why are all header files not declared in every c program?

609


What do you mean by dynamic memory allocation in c?

658


Explain what header files do I need in order to define the standard library functions I use?

655