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
Should a constructor be public or private?
What does getch() do according to the ANSI C++ standard a) Reads in a character b) Checks the keyboard buffer c) Nothing in particular (Its not defined there)
Differentiate between an external iterator and an internal iterator? What is the advantage of an external iterator.
What kind of jobs can I get with c++?
Is atoi safe?
What is srand c++?
What flag means?
What is meant by forward referencing and when should it be used?
Can notepad ++ run c++?
Is c++ an oop?
Is facebook written in c++?
What is code reusability in c++?
Explain how the virtual base class is different from the conventional base classes of the opps.
How do I use turbo c++?
Explain abstraction.