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 / md.irfan(rourkela)

#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 ?    145 Yes 91 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does scope resolution operator do?

1164


What are disadvantages of pointers?

1093


What do you mean by function pointer?

1165


Why was c++ created?

1084


Can member functions be private?

1049


What is difference between array and vector in c++?

1074


What are protected members in c++?

1178


What character terminates all character array strings a) b) . c) END

1348


What is the difference between a definition and a declaration?

1113


What is difference between c++ 11 and c++ 14?

1170


How can you specify a class in C++?

1334


Why c++ is so important?

1137


Write about the role of c++ in the tradeoff of safety vs. Usability?

1128


What is array give example?

1107


When the constructor of a base class calls a virtual function, why doesn't the override function of the derived class gets called?

1150