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 different between auto and local static? why should we use local static?

644


Write a program to implement a round robin scheduler and calculate the average waiting time.Arrival time, burst time, time quantum, and no. of processes should be the inputs.

619


What is structure data type in c?

569


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

783


Explain what is meant by high-order and low-order bytes?

633






printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions

636


What is unsigned int in c?

556


Why doesnt the call scanf work?

667


write a c program in such a way that if we enter the today date the output should be next day's date.

1677


Why c is procedure oriented?

572


Tell me the use of bit field in c language?

626


What is dynamic memory allocation?

807


What is memcpy() function?

620


Is fortran still used today?

602


Write a program to generate a pulse width frequency of your choise,which can be variable by using the digital port of your processor

2983