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
What are c identifiers?
Write a program to check whether a number is prime or not using c?
what are bit fields in c?
What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.
What are structure types in C?
How to explain the final year project as a fresher please answer with sample project
pierrot's divisor program using c or c++ code
What is dangling pointer in c?
Write a program to reverse a string.
How do shell structures work?
Write the control statements in C language
Why c is called object oriented language?
How can I discover how many arguments a function was actually called with?
What is structure and union in c?
Create a registration form application by taking the details like username, address, phone number, email with password and confirm password (should be same as password).Ensure that the password is of 8 characters with only numbers and alphabets. Take such details for 3 users and display the details. While taking input password must appear as “****”.