View Code of Problem 93

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main() {
	int m,n,i,j;
	scanf("%d %d",&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]=a[i]+j;
			}
		}
	}
	for(i=m;i<=n;i++){
		for(j=i+1;j<=n;j++){
			if((a[i]==j) && (a[j]==i) && i!=j){
				printf("%d %d\n",i,j);
			}
		}
	}
}

Double click to view unformatted code.


Back to problem 93