Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- #include <math.h>
- using namespace std;
- int main(int argc, char *argv[])
- {
- double N,k,n=2,acum=0;
- cout<<"Ingrese un numero"<<endl;
- cin>>N;
- do {
- acum= pow(2,k-1)*(pow(2,k)-1);
- if ( acum<N ){
- acum=0;
- k=k+1;
- }
- else if ( acum>N) {
- cout<<"No es perfecto"<<endl;
- }
- else if ( acum == N ) {
- cout<<"Es numero perfecto"<<endl;
- }
- }while ( acum < N );
- system("PAUSE");
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment