View Code of Problem 93

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

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

Double click to view unformatted code.


Back to problem 93