Current location - Health Preservation Learning Network - Healthy weight loss - C language training intimacy degree
C language training intimacy degree
# include & ltstdio.h & gt

# define n3000yzh ();

void main()

{

/* int a; scanf("%d ",& ampa); printf("%d ",Yzh(a)); */

int a,b,I,j;

for(I = 2; I & ltn;; i++)

{

a = Yzh(I);

for(j = 2; j & ltn; j++)

{

b = Yzh(j);

if(a = = j & amp; & ampb = = i & amp& amp & ltJ) // It should be less than, because the smaller number comes first.

printf("(%d,%d)",I,j);

}

}

}

int Yzh(int x)

{

int n,sum = 0;

for(n = 1; n & lt= x/2; n++)

{

if(x%n==0)

sum+= n;

}

Returns the sum; //Because you want to use the sum of factors in the main function, you must return the value of the calling function to the main function.

}

This is your code that I modified, and the output meets your requirements, but the intimacy number within 3000 seems to be only 3 pairs.