|
Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
|
A C++ Program to check whether a pair of number is amicable pair or not. More...
#include <cassert>#include <iostream>Functions | |
| int | sum_of_divisor (int num) |
| bool | are_amicable (int x, int y) |
| void | test () |
| int | main () |
A C++ Program to check whether a pair of number is amicable pair or not.
Amicable Pair are two positive integers such that sum of the proper divisor of each number is equal to the other number.
| bool are_amicable | ( | int | x, |
| int | y | ||
| ) |
Function to check whether the pair is amicable or not.
| x | First number. |
| y | Second number. |
true if the pair is amicable false if the pair is not amicable | int main | ( | void | ) |
| int sum_of_divisor | ( | int | num | ) |
Function to calculate the sum of all the proper divisor of an integer.
| num | First number. |
| void test | ( | ) |
Function for testing the is_amicable() with all the test cases.