P051.c
Problem Statement
P051.c
Write a program to input two number and check whether they are Amicable Pair or not Example : Sum of Proper Divisors of 220 (1, 2, 4, 5, 10, 11, 20, 22, 44, 55, 110) = 284 Sum of Proper Divisors of 284 (1, 2, 4, 71, 142) = 220
Source Code
c
#include <stdio.h>
int main()
{
int a, b, i, sa = 0, sb = 0;
printf("Enter two number : ");
scanf("%d %d", &a, &b);
for (i = 1; i <= a / 2; i++)
if (a % i == 0)
sa += i;
for (i = 1; i <= b / 2; i++)
if (b % i == 0)
sb += i;
if (sa == b && sb == a)
printf("\nInput %d and %d is Amicable Pair.", a, b);
else
printf("\nInput %d and %d is Not Amicable Pair.", a, b);
return 0;
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
● Author - Amit Dutta · Updated - 12 Dec 2025