P051.c (1055B)
1 /* 2 * Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 12 Dec 2025 3 * Repo: https://github.com/notamitgamer/bsc 4 * License: MIT 5 */ 6 7 /* Write a program to input two number and check whether they are Amicable Pair or not 8 Example : Sum of Proper Divisors of 220 (1, 2, 4, 5, 10, 11, 20, 22, 44, 55, 110) = 284 9 Sum of Proper Divisors of 284 (1, 2, 4, 71, 142) = 220 */ 10 11 // This code has not been compiled. 12 // If you find any issues, please create a new issue on GitHub regarding them. 13 // Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues 14 15 #include <stdio.h> 16 17 int main() 18 { 19 int a, b, i, sa = 0, sb = 0; 20 printf("Enter two number : "); 21 scanf("%d %d", &a, &b); 22 for (i = 1; i <= a / 2; i++) 23 if (a % i == 0) 24 sa += i; 25 for (i = 1; i <= b / 2; i++) 26 if (b % i == 0) 27 sb += i; 28 if (sa == b && sb == a) 29 printf("\nInput %d and %d is Amicable Pair.", a, b); 30 else 31 printf("\nInput %d and %d is Not Amicable Pair.", a, b); 32 return 0; 33 }