write the program for prime numbers?
Answer Posted / gnanasekaran
int main()
{
int i,j,n,f=0;
printf("Enter the length\n");
scanf("%d",&n);
for(i=2;i<=n/2;i++)
{
for(j=2;j<i;j++)
{
if((i%j)==0)
{
f=1;
break;
}
f=0;
}
if(f==0)
printf("%d ",i);
}
}
Is This Answer Correct ? | 139 Yes | 81 No |
Post New Answer View All Answers
What are linker error?
write a proram to reverse the string using switch case?
What is extern keyword in c?
#define MAX(x,y) (x) >(y)?(x):(y) main() { inti=10,j=5,k=0; k= MAX(i++,++j); printf("%d..%d..%d",i,j,k); }
Write a program to check armstrong number in c?
please explain every phase in the "SDLC" in the dotnet.
What is the concatenation operator?
What is a stream?
What is the difference between exit() and _exit() function in c?
What is the best way to store flag values in a program?
What is a good way to implement complex numbers in c?
What is the difference between void main and main in c?
What do you mean by recursion in c?
Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
Explain what is dynamic data structure?