Abundant Number

Abundant Number is a number whose sum of proper factors is greater than the number itself.

Example 1: 18. Sum of proper factors = 1+2+3+6+9 = 21>18. Hence it is an Abundant Number.

Example 2: 14. Sum of proper factors = 1+2+7 = 10<12. Hence it is not an Abundant Number.

C
#include <stdio.h>
int main()
{
    int n=0,sum=0;
    printf("Enter a number: ");
    scanf("%d",&n);
    for(int i=1;i<n;i++)
    {
        if(n%i==0)
        {
            sum=sum+i;
        }
    }
    if(n<sum)
    {
        printf("%d is an Abundant Number",n);
    }
    else
    {
        printf("%d is not an Abundant Number",n);
    }
    return 0;
}
C