write the program for prime numbers?

Answer Posted / shubhanshu pandey

main()
{
int a,c=0,i,n;
printf("enter the number to be checked");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
a=n%i;
if(a=0)
{
c=c+1;
}
}
if (c=2)
{ printf("the given number is prime"); }
else
printf("the given number is not prime");
}

Is This Answer Correct ?    7 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is typeof in c?

610


Can we use any name in place of argv and argc as command line arguments?

610


What is pointers in c with example?

584


explain what is fifo?

635


What is difference between && and & in c?

600






What are # preprocessor operator in c?

632


What does c in a circle mean?

584


What is a pointer variable in c language?

646


What is wrong in this statement?

607


Is return a keyword in c?

599


Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.

706


What is #define?

577


How does placing some code lines between the comment symbol help in debugging the code?

549


Why does the call char scanf work?

621


Explain is it better to bitshift a value than to multiply by 2?

719