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 / pramod k sharma

#include<iostream.h>
#include<conio.h>
main()
{
int n,i,f=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 ?    14 Yes 32 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Define the operators that can be used with a pointer.

1045


Which header file allows file i/o with streams a) fileio.h b) iostream.h c) fstream.h

1129


Which bitwise operator is used to check whether a particular bit is on or off?

1056


What is the oldest programming language?

1014


What are static and dynamic type checking?

1078


What is conditions when using boolean operators?

1217


C is to C++ as 1 is to a) What the heck b) 2 c) 10

1057


Is c++ an integer?

1028


What is the difference between structures and unions?

1056


Can recursive program be written in C++?

1227


What is c++ stringstream?

1099


Why pointer is used in c++?

1152


What do the keywords volatile and mean mutable?

1050


What is a hash function c++?

1067


Differentiate between a pointer and a reference with respect to c++.

1239