View Code of Problem 93

#include<stdio.h>
void main() {
	int m,n,i,j,temp;
	scanf("%d %d",&m,&n);
		if(m>n){
			temp=n;
			n=m;
			m=temp;
		}
		int a[n+1];
		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(i==a[j]&&j==a[i])
					printf("%d %d\n",i,j);
			}
		}
}

Double click to view unformatted code.


Back to problem 93