write the program for prime numbers?
Answer Posted / sham
int main()
{
int i,j,n,f=0;
printf("Enter the length\n");
scanf("%d",&n);
for(i=2;i<=n;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 ? | 180 Yes | 107 No |
Post New Answer View All Answers
What is a buffer in c?
What are the main characteristics of c language describe the structure of ac program?
the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none
Is there a way to switch on strings?
how should functions be apportioned among source files?
What does it mean when a pointer is used in an if statement?
if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0
What is meant by preprocessor in c?
Is null always defined as 0(zero)?
When should the register modifier be used? Does it really help?
What is the difference between a string and an array?
What happens if you free a pointer twice?
write a program to copy the string using switch case?
What is ctrl c called?
How can you determine the size of an allocated portion of memory?