A C program to test whether a given pair of numbers is amicable numbers is as
follows:
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int i,j,n,sum_i=0,sum_j=0;
clrscr();
printf("enter any two numbers >");
scanf("%d%d",&i,&j);
for(n=1;n<i;n++)
{
if (i%n==0)
sum_i+=n;
}
for (n=1;n<j;n++)
{ if (j%n==0)
sum_j+=n;
}
if ((sum_j==i) && (sum_i==j))
printf ("\nAmicable");
else
printf ("\nNot Amicable");
getch();
}