Excessive number is a number for which the sum of its proper divisors is greater than the number itself.
The integer 12 is the first abundant number. Its proper divisors are 1, 2, 3, 4 and 6 for a total of 16.
Solution:
using System;
namespace ExcessiveNumber
{
class Program
{
static void Main()
{
Console.WriteLine("Enter the number:");
var n = Convert.ToInt32(Console.ReadLine());
var result = ExcessiveSum(n) > n;
Console.WriteLine(result ? "Excessive number." : "Not Excessive number.");
}
static int ExcessiveSum(int n)
{
var sum = 0;
for (var i = 1; i <= Math.Sqrt(n); i++)
{
if (n % i != 0) continue;
if (n / i == i)
{
sum += i;
}
else
{
sum += i;
sum += n / i;
}
}
sum -= n;
return sum;
}
}
}