Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Describe the advantage of an external iterator.

1042


Can you declare an array without a size in c++?

1020


What is difference between rand () and srand ()?

1090


How does the copy constructor differ from the assignment operator (=)?

1153


What is abstraction in c++?

1362


Explain binary search.

995


What is new in c++?

1103


Define the operators that can be used with a pointer.

1063


Can I have a reference as a data member of a class? If yes, then how do I initialise it?

1231


What is a c++ vector?

1058


Write a function to perform the substraction of two numbers. Eg: char N1="123", N2="478", N3=-355(N1-N2).

1001


What is the full form of stl in c++?

1196


How can you prevent accessing of the private parts of my class by other programmers (violating encapsulation)?

1085


How does a copy constructor differs from an overloaded assignment operator?

1045


Write about the use of the virtual destructor?

1009