write the program for prime numbers?

Answer Posted / arfu

#include<stdio.h>

int main()
{
int c,i,n;
c=0;
scanf("%d",&a);
for(i=2;i<a;i++)
if (n%i==0)
{
c=1;break;
}
if(c!=1)`("prime");
else printf ("not a prime");
}

Is This Answer Correct ?    110 Yes 89 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are # pragma staments?

1617


Explain 'bus error'?

546


Do you know the use of 'auto' keyword?

650


Tell us the use of fflush() function in c language?

630


How is a null pointer different from a dangling pointer?

550






What is the purpose of void in c?

609


Why is c not oop?

533


#include main() { int *p, *c, i; i = 5; p = (int*) (malloc(sizeof(i))); printf(" %d",*p); *p = 10; printf(" %d %d",i,*p); c = (int*) calloc(2); printf(" %d ",*c); }

620


if the area was hit by a virus and so the decrease in the population because of death was x/3 and the migration from other places increased a population by 2x then annually it had so many ppl. find our the population in the starting.

4485


What is the difference between Printf(..) and sprint(...) ?

777


What are the application of void data type in c?

685


What is infinite loop?

619


What are valid signatures for the Main function?

694


what is the diffrenet bettwen HTTP and internet protocol

1383


Explain what is meant by 'bit masking'?

636