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

Discussion on error handling of C++ .

1084


What are pointers used for c++?

1021


Differentiate between structure and class in c++.

1040


How do you import payscale data from non SAP to SAP?is it through LSMW or any other way is there?

3605


What is the best free c++ compiler for windows?

1066


What are the five basic elements of a c++ program?

1064


What are the c++ access specifiers?

1364


Which one is better- macro or function?

1141


What is the hardest coding language to learn?

1007


What are the benefits of operator overloading?

1166


What does floor mean in c++?

1031


What are the two shift operators and what are their functions?

1045


Why do we use pointers in c++?

988


What does getch() do according to the ANSI C++ standard a) Reads in a character b) Checks the keyboard buffer c) Nothing in particular (Its not defined there)

1011


Can the creation of operator** is allowed to perform the to-the-power-of operations?

960