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
What does a pointer variable always consist of?
Why can arithmetic operations not be performed on void pointers?
What is actual argument?
What is structure padding and packing in c?
Do you know what are bitwise shift operators in c programming?
Why does everyone say not to use scanf? What should I use instead?
What is data structure in c programming?
Write a program to reverse a string.
Explain how do you sort filenames in a directory?
Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]
How will you find a duplicate number in a array without negating the nos ?
What is file in c preprocessor?
How can you tell whether a program was compiled using c versus c++?
Explain the use of fflush() function?
What is table lookup in c?