View Code of Problem 93

#include<stdio.h>
#include <string.h>
#include <math.h>
int main(){
	int m,n;
	int a,b;
	int i,j,k;
	scanf("%d%d",&m,&n);
	for(a=m;a<=n;a++){
		b=1;
		for(i=2;i<=a/2;i++){
			if(a%i==0)
			b+=i;
		}
		k=1;
		for(j=2;j<=b/2;j++){
			if(b%j==0)
			k +=j;
		}
		if(a==k&&a!=b&&a<b){
			printf("%d %d\n",a,b);
		}
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 93