Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Program: perfecto.cc
- // Author: Yoan Pinzon
- // Date: Agosto 30, 2006
- #include <iostream>
- using namespace std;
- int main(){
- int n;
- cout << "Entre n: "; cin >> n;
- for(int i=1; i<=n; i++){
- int s=0;
- for(int j=1; j<i; j++) s+=(i%j==0?j:0);
- if (i==s){
- cout << i << "=";
- for(int j=1; j<i; j++) if(i%j==0) cout << j << "+";
- cout << "\b \n";
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement