write the prime no program in c++?

Answer Posted / darren chang

bool checkPrime(int input)
{
for(int i=2; i<(input/2); i++)
{
if((input%i)==0)
{
return false;
}
}
return true;
}

Is This Answer Correct ?    14 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program using GUI concept for the scheduling algorithms in Operating system like SJF,FCFS etc..

3354


What do you mean by enumerated data type?

570


In which situation the program terminates before reaching the breakpoint set by the user at the beginning of the mainq method?

584


What is virtual destructor? What is its use?

573


Do we have to use initialization list in spite of the assignment in constructors?

563






What is a catch statement?

579


List the issue that the auto_ptr object handles?

609


Define what is constructor?

580


Explain friend class?

622


Why are pointers used?

578


Explain how a pointer to function can be declared in C++?

578


Distinguish between a # include and #define.

643


Difference between delete and free.

611


What do you mean by vtable and vptr in c++?

619


What does flush do c++?

551