Write a program to find whether the given number is prime or
not?
Answer Posted / sudha
#include<stdio.h>
#include<conio.h>
void main()
{
int isprime=1;
int n,i;
printf("enter a number");
scanf("%d",&n);
if(i=2;i<=n/2;i++)
{
if((n%i)==0)
{
isprime=0;
break;
}
}
if(isprime==1)
{
printf("%d is a prime number",n);
}
else
{
printf("%d is not a prime number",n);
}
getch();
}
| Is This Answer Correct ? | 18 Yes | 5 No |
Post New Answer View All Answers
Tell me is null always defined as 0(zero)?
How to delete a node from linked list w/o using collectons?
What is use of integral promotions in c?
How can a process change an environment variable in its caller?
What do you mean by command line argument?
What is a dynamic array in c?
What do you mean by keywords in c?
When should a type cast be used?
What is ## preprocessor operator in c?
How do you determine the length of a string value that was stored in a variable?
What are the types of i/o functions?
Why we use void main in c?
How is a structure member accessed?
‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.
Tell us something about keyword 'auto'.