Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- using namespace std;
- int main(int argc, char *argv[])
- {
- int N,i,div=2;
- cout<<"Ingrese un valor"<<endl;
- cin>>N;
- if ( N%2==0 && N!=2 ){
- cout<<"No es numero primo"<<endl;
- } else {
- for ( i=3 ; i<N ; i++ ){
- if ( N%i==0 ){
- div=div+1;
- }
- }
- if ( div>2 ) {
- cout<<"No es numero primo"<<endl;
- } else {
- cout<<N<<" ";
- }
- system("PAUSE");
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement