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 / adnan sheikh

#include<iostream.h>
#include<conio.h>

main()
{
int i,j,num;
cout<<"enter nay number";
cin>>num;
j=static_cast<int>(num/2);
for(int i=2;i<=j;i++)
{
if(!(num%i))
break;
}
if(i==(j+1))
cout<<"number is prime";
else
cout<<"number is not prime";
getch();
}

Is This Answer Correct ?    8 Yes 19 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which is most difficult programming language?

1029


What is the role of C++ shorthand's?

1224


Explain what is polymorphism in c++?

1080


What is while loops?

995


When do you call copy constructors?

1081


What is endianness?

1040


What are the effects after calling the delete this operator ?

989


When do we run a shell in the unix system?

1019


Why is c++ a mid-level programming language?

963


What is meant by const_cast?

1071


Is atoi safe?

1009


What is the role of static keyword for a class member variable?

1028


Why is main function important?

1051


What is the best c++ book for beginners?

1089


Can non-public members of another instance of the class be retrieved by the method of the same class?

1029