View Code of Problem 93

#include <bits/stdc++.h>
using namespace std;

int yz(int num) {
    int res=0;
    for(int i=1; i<num; i++) {
        if(num%i==0)
            res+=i;
    }
    return res;
}
int main() {
    int a,b;
    cin>>a>>b;
    for(int i=a; i<b; i++) {
        for(int j=i+1; j<=b; j++) {
            if(yz(i)==j&&yz(j)==i)
                cout<<i<<" "<<j<<endl;
        }
    }

    return 0;
}

Double click to view unformatted code.


Back to problem 93