Answer Posted / m.shanmuga sundaram,rjnsoftwar
void main()
{
int primeNo;
int i;
bool isPrime = false;
printf("Enter a number to check prime or not\n");
scanf("%d",&primeNo);
for(i = 2; i <= primeNo / 2; i++)
{
if(primeNo % i == 0)
{
isPrime = true;
break;
}
}
if(isPrime)
printf("The number is a prime number %
d\n",primeNo);
else
printf("The number is not a prime number %
d\n",primeNo);
}
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
How do you declare A pointer to function which receives an int pointer and returns a float pointer
Can union be self referenced?
Explain rethrowing exceptions with an example?
Which software is best for programming?
State two differences between C and C++.
Out of fgets() and gets() which function is safe to use?
What is the use of default constructor?
What size is allocated to the union variable?
What is dev c++ used for?
What is heap sort in c++?
What do the header files usually contains?
What is const pointer and const reference?
What is the meaning of string in c++?
What is the average salary of a c++ programmer?
Why c++ is called oop?