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 adt in c programming?
What is the use of linkage in c language?
using for loop sum 2 number of any 4 digit number in c language
What are 3 types of structures?
main() { inta=10,b=20; a>=5?b=100:b=200; printf("%d ",b); }
Explain the difference between structs and unions in c?
What is "Duff's Device"?
how logic is used
Explain the Difference between the New and Malloc keyword.
Are there constructors in c?
How can I write data files which can be read on other machines with different word size, byte order, or floating point formats?
What is the difference between the expression “++a” and “a++”?
What does a pointer variable always consist of?
What is the difference between exit() and _exit() function in c?
What are terms in math?