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

What do you mean by ‘void’ return type?

1103


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

1112


Write a program to find the Fibonacci series recursively.

1112


What is the latest c++ version?

1150


Define 'std'.

1223


You run a shell on unix system. How would you tell which shell are you running?

1216


Explain how to initialize a const member data.

1080


What is the use of typedef?

1145


How do you instruct your compiler to print the contents of the intermediate file showing the effects of the preprocessor?

1206


Is dev c++ a good compiler?

1013


How many ways can a variable be initialized into in C++?

1064


Name the operators that cannot be overloaded in C++?

1110


Who calls main function?

1163


If dog is a friend of boy and boy is a friend of house, is dog a friend of house?

1062


What does new in c++ do?

1068