#include<stdio.h> #include <string.h> #include <math.h> int main(){ int a,b; int i,j,k; int x,y; scanf("%d %d",&a,&b); for(i=a;i<=b;i++){ j=1; for(x=2;x<=i/2;x++){ if(i%x==0) j +=x; } k=1; for(y=2;y<=j/2;y++){ if(j%y==0){ k +=y; } } if(i==k&&i!=j){ if(i>j){ printf("%d %d\n",j,i);} else{ printf("%d %d\n",i,j);} } } printf("\n"); return 0; } |
Double click to view unformatted code.