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 / suresh kumar

#include<iostream.h>
#include<conio.h>
void main()
{
int n,k,i=1;
cout<<"enter any no to check prime";
cin>>n;
for(i=2;i<n;i++)
{
if(n%i==0)
k=2;
}
if(k==2)
cout<<"the no is not prime"<<endl;
else
cout<<"the no is prime";
getch();
}

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which operator cannot overload?

988


What is problem with overriding functions?

1003


What is the equivalent of Pascal's Real a) unsigned int b) float c) char

970


What are the advantage of using register variables?

1111


Why is null pointer used?

1113


How is c++ different from java?

991


How would you use the functions sin(), pow(), sqrt()?

1128


What is one dimensional array in c++?

1042


How do you declare A pointer to a function which receives nothing and returns nothing

1171


What are multiple inheritances (virtual inheritance)?

1020


Can you please explain the difference between using macro and inline functions?

989


What is prototype in c++ with example?

1051


Which function should be used to free the memory allocated by calloc()?

975


What is name hiding in c++?

1106


program explaining feautures of c++

2389