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
Write a program to produce the following output: 1 2 3 4 5 6 7 8 9 10
Explain what is a stream?
Where we use clrscr in c?
Is this program statement valid? INT = 10.50;
Explain indirection?
what is the diffrenet bettwen HTTP and internet protocol
Write a program to implement a round robin scheduler and calculate the average waiting time.Arrival time, burst time, time quantum, and no. of processes should be the inputs.
Why cant I open a file by its explicit path?
What does it mean when a pointer is used in an if statement?
Write a program to print fibonacci series using recursion?
a parameter passed between a calling program and a called program a) variable b) constant c) argument d) all of the above
How can you determine the maximum value that a numeric variable can hold?
Explain which of the following operators is incorrect and why? ( >=, <=, <>, ==)
what do the 'c' and 'v' in argc and argv stand for?
Why ca not I do something like this?