View Code of Problem 93

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

int main(){
	int m,n,i,j;
	cin>>m>>n;
	int a[10000];
	for(i = m; i <= n; i++){
		a[i] = 0;
		for(j = 1; j <= i/2; j++){
			if(i % j == 0) a[i] += j;
		}
	}
	for(i=m;i<=n;i++){
		for(j = i+1; j <= n; j++){
			if(a[i]==j&&a[j]==i){
				cout<<i<<" "<<j<<endl;
			}
		}
	}
}

Double click to view unformatted code.


Back to problem 93