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

Describe exception handling concept with an example?

1048


What is enum c++?

1231


What is rtti in c++?

1134


Explain linked list using c++ with an example?

1082


Is there a sort function in c++?

993


What is the difference between while and do while loop?

1150


What is the use of setprecision in c++?

1010


What does std :: flush do?

1131


How do I download c++?

1005


What is a wchar_t in c++?

1133


Which is the best c++ compiler?

1048


Tell me can a pure virtual function have an implementation?

1022


What are guid? Why does com need guids?

1049


Define the operators that can be used with a pointer.

1043


Will c++ be replaced?

1040