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

Define macro.

804


What is == in programming?

783


What are the extraction and insertion operators in c++?

750


Is map ordered c++?

810


Do class declarations end with a semicolon?

771


an operation between an integer and real always yeilds a) integer result b) real result c) float result

926


Which sort is best for the set: 1 2 3 5 4 a) Quick Sort b) Bubble Sort c) Merge Sort

850


What is the history of c++?

725


Explain the differences between list x; & list x();.

752


How many keywords are used in c++?

758


What is a driver program?

830


Is swift better than c++?

716


What does the nocreate and noreplace flag ensure when they are used for opening a file?

875


How can you differentiate between inheritance and implementation in c++?

864


Explain the concept of memory leak?

838