View Code of Problem 93

#include<stdio.h>
main(){
	int m, n;
	scanf("%d %d",&m,&n);
	int arr[10000];
	int k = 0;
	for (int i = m; i <= n; i++)
	{
		int count = 0;
		for (int j = 1; j < i; j++)
		{
			if (i%j==0)
			{
				count += j;
			}
		}
			arr[k] = count;
			k++;
	}
	for (int i = m; i <= n; i++)
	{
		for (int j = 0; j  < n-m+1; j ++)
		{
			if (arr[j]==i&&arr[i-m]==m+j&&i!=(m+j))
			{
				if (m+j<i)
				{
					printf("%d %d\n", m + j, i);
				}
				
			}
		}
	}
}

Double click to view unformatted code.


Back to problem 93