View Code of Problem 93

#include<iostream>
using namespace std;
int yinzihe(int x)
{   int sum=0;
	for(int i=1;i<x;i++)
	{
		if(x%i==0) sum=sum+i;
	}
	return sum;
}
int main()
{
	int m,n;
	cin>>m>>n;
	for(int i=m;i<=n;i++)
	{
		for(int j=i;j<=n;j++)
		  {
		  	if((yinzihe(i)==j)&&yinzihe(j)==i&&(i<j))
			  {
			  	cout<<i<<" "<<j<<endl;
			   } 
		  }
		   
	}
	

}

Double click to view unformatted code.


Back to problem 93