P051.c ​
Metadata ​
- Author — Amit Dutta (amitdutta4255@gmail.com)
- Last updated — 12 Dec 2025
- License — MIT
Problem Statement ​
Problem Statement
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 ​
Printing the code
To print this file, open it on GitHub and click Raw before printing, or use the Download Raw button above and print directly from that page.
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