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
Differentiate between declaring a variable and defining a variable?
#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); }
What will be your course of action for a push operation?
FORMATTED INPUT/OUTPUT functions are a) scanf() and printf() b) gets() and puts() c) getchar() and putchar() d) all the above
What are the 5 data types?
Write a program for Overriding.
in linking some of os executables are linking name some of them
What's the total generic pointer type?
When should the const modifier be used?
what is stack , heap ,code segment,and data segment
What is echo in c programming?
What is bss in c?
Create a simple code fragment that will swap the values of two variables num1 and num2.
Wt are the Buses in C Language
What is define c?