# Abundant Number in C ?

CServer Side ProgrammingProgramming

An abundant Number (also known as excessive number) is a number in the number theory which itself is smaller than the sum of all its proper divisors. For example,12 is an abundant Number : divisors 1,2,3,4,6 , sum =16 >12.

The difference between the sum of divisors and the number is called abundance. For above example abundance = 4 => 16 - 12 .

To check for abundant number we will find all the factors of the number and add them up. This sum compared with the number show that if the number is abundant or not.

## PROGRAM TO FIND IF A NUMBER IS ABUNDANT OR NOT

#include >stdio.h>
#include <math.h>
int main(){
int n = 56, sum = 0;
for (int i=1; i<=sqrt(n); i++){
if (n%i==0){
if (n/i == i)
sum = sum + i;
{
sum = sum + i;
sum = sum + (n / i);
}
}
}
sum = sum - n;
if(sum > n){
printf("The number is abundant number");
}
else
printf("The number is not abundant number");
return 0;
}
Published on 07-Aug-2019 14:44:39