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
What is typeof in c?
Can we use any name in place of argv and argc as command line arguments?
What is pointers in c with example?
explain what is fifo?
What is difference between && and & in c?
What are # preprocessor operator in c?
What does c in a circle mean?
What is a pointer variable in c language?
What is wrong in this statement?
Is return a keyword in c?
Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.
What is #define?
How does placing some code lines between the comment symbol help in debugging the code?
Why does the call char scanf work?
Explain is it better to bitshift a value than to multiply by 2?