#include<stdio.h>
#include "amicablenumber.h"
int i,j;
struct amicable
{
int **amicablePair;
int size;
};
main()
{
int startnum = 250;
int endnum = 1000;
struct amicable* ami;
ami = getAmicablePairs(startnum, endnum);
printf("{");
for(int i = 0; i<ami->size; i++)
{
printf("{%d, %d}",ami->amicablePair[i][0], ami->amicablePair[i][1]);
}
printf("}");
}
amicable *getAmicablePairs(int startnum,int endnum)
{
int size=0;
int sumfactors(int);
amicable record;
for(i=startnum;i<=endnum;i++)
{
for(j=endnum;j>=startnum;j--)
{
if((sumfactors(i)==j)&&(sumfactors(j)==i) && (i!=j))
{
record.amicablePair[size][0]=i;
record.amicablePair[size][1]=j;
size++;
}}}
record.size=size;
return record;
}
int sumfactors(int number)
{
int sum=0;
for(i=1;i<number;i++)
{
if(number%i==0)
sum +=i;
}
return sum;
}
in the above code i m getting a error
cannot convert amicable to amicable* in return