# Program to check whether a number is Abundant number or not | faceprep

Program to check whether a number is Abundant number or not is discussed here. An abundant number is a number for which the sum of its proper divisors is greater than the number itself.

Input & Output format:

• Input consists of 1 integer.
• If it is an Abundant number display “Abundant Number” or display “Not Abundant Number”.

Sample input:
12

Sample Output:
Abundant Number

Explanation:

The divisors of 12 are 1, 2, 3, 4 and 6.
The sum of divisors of 12 is 16.
12 < 16.Hence, 12 is an abundant number.

## Algorithm to check whether a number is an abundant number or not

• Input a number from the user.
• Find the sum of its divisors.
• If sum < num, print “Abundant Number”.
• Else, print “Not Abundant Number”.

Program to check whether a number is an abundant number or not is given below.

// C program to check whether a number is an abundant number or not

#include<stdio.h>
int main()
{
//fill the code
int num;
int temp;
scanf(“%d”,&num);
int sum = 0;
for(int i = 1; i < num; i++)
{
if(num % i == 0)
{
sum = sum + i;
}
}
if(num < sum)
printf(“Abundant Number”);
else
printf(“Not Abundant Number”);
return 0;
}

// C++ program to check whether a number is an abundant number or not

#include<iostream>
using namespace std;

int main()
{
//fill the code
int num;
int temp;
cin >> num;
int sum = 0;
for(int i = 1; i < num; i++)
{
if(num % i == 0)
{
sum = sum + i;
}
}
if(num < sum)
cout << “Abundant Number”;
else
cout << “Not Abundant Number”;
return 0;
}

// Java program to check whether a number is an abundant number or not

import java.util.*;
public class Main
{
public static void main(String[] args)
{
int num, temp;
Scanner sc = new Scanner(System.in);
num = sc.nextInt();
int sum = 0;
for(int i = 1; i < num; i++)
{
if(num % i == 0)
{
sum = sum + i;
}
}
if(num < sum)
System.out.print(“Abundant Number”);
else
System.out.print(“Not Abundant Number”);
}
}

# Python program to check whether a number is an abundant number or not

num = int(input())
sum = 0
for i in range(1,num):
if(num % i == 0):
sum = sum + i
if(num < sum):
print(“Abundant Number”)
else: 