Module: (C++) Subroutines: Procedures and Functions - 2

Problem

11
/11

*Friendly numbers on the range

Problem

Write a program that finds all pairs of friendly numbers in a given range. Use a function that calculates the sum of the divisors of a number and a function that determines whether two numbers are friendly or not. You should have TWO functions in your program

Input: The input string contains two natural numbers – range bounds a and b . It is guaranteed that a ≤ b .

Output: The program should print all pairs of amicable numbers in the given range on one line separated by a space. Each pair must be enclosed in parentheses, separated by spaces. There should not be extra spaces at the beginning and at the end of the line.

If there are no friendly numbers in the given range, the program should output 0.