how to find the given number is prime or not?
Answer Posted / rahul tiwari
main()
{
int n,ctr=2,flag=0;
printf("enter the number to be checked\n");
scanf("%d",&n);
for(ctr=2;ctr<=n/2;ctr++)
{
if(n%ctr==0)
{
flag=1;
break;
}
}
if(flag==1)
printf("the given number is prime\n");
else
printf("the given number is not prime\n");
flag=9
getch();
}
| Is This Answer Correct ? | 8 Yes | 7 No |
Post New Answer View All Answers
Which one to choose from 'initialization lists' or 'assignment', for the use in the constructor?
How is a null pointer different from a dangling pointer?
why we wont use '&' sing in aceesing the string using scanf
Who is the founder of c language?
Explain about the constants which help in debugging?
Iam a B.Tech graduate and completed my engineering in 2009, from 2005 to 2009 and after that i had done nothing.Now i want to do job and get into BPO field . Friends give me suggestions as what to say in interview... if they ask me that what would you had done ... these many years without doing job ??????? pls urgent
What does node * mean?
A collection of functions,calls,subroutines or other data a) library b) header files c) set of files d) textfiles
What are the disadvantages of external storage class?
What is c programming structure?
Can variables be declared anywhere in c?
How do I use void main?
how many types of operators are include in c language a) 4 b) 6 c) 8 d) 12
What do you mean by invalid pointer arithmetic?
Can you explain the four storage classes in C?