# Check whether a given number is an Abundant number or not

Write a C program to check whether a given number is an Abundant number or not. or Write a program to check whether a given number is an Abundant number or not in C.

Program in C

Code:

/*Write a C program to check whether a given number is an Abundant number or not. or Write a program to  check whether a given number is an Abundant number or not Using C*/

#include<stdio.h>
int main()
{
int num,i;
printf("Enter a number:");
scanf("%d",&num);
int sum=0;
for( i=1;i<num;i++)
{
if(num%i==0)
{
sum=sum+i;
}
}

if(sum>num)
printf("It is an Abundant Number");
else
printf("It is not an Abundant Number");
}

Input/Output:
Enter a number:120
It is an Abundant Number

Write a C++ program to check whether a given number is an Abundant number or not. or Write a program to check whether a given number is an Abundant number or not in C++.

Program in C++

Code:

/*Write a C++ program to check whether a given number is an Abundant number or not. or Write a program to check whether a given number is an Abundant number or not using C++*/

#include<iostream>
using namespace std;
int main()
{
int num;
cout<<"Enter a number:";
cin>>num;
int sum=0;
for(int i=1;i<num;i++)
{
if(num%i==0)
{
sum=sum+i;
}
}

if(sum>num)
cout<<"It is an Abundant Number";
else
cout<<"It is not an Abundant Number";
}

Input/Output:
Enter a number:21
It is not an Abundant Number

Write a JAVA program to check whether a given number is an Abundant number or not. or Write a program to check whether a given number is an Abundant number or not in Java.

Program in Java

Code:

/*Write a JAVA program to check whether a given number is an Abundant number or not. or Write a program to check whether a given number is an Abundant number or not using Java*/

import java.util.Scanner;
public class AbundantNumberOrNot {

public static void main(String[] args) {
Scanner cs=new Scanner(System.in);
int num,i;
System.out.println("Enter a number:");
num=cs.nextInt();
int sum=0;
for( i=1;i<num;i++)
{
if(num%i==0)
{
sum=sum+i;
}
}
if(sum>num)
System.out.println("It is an Abundant Number");
else
System.out.println("It is not an Abundant Number");
cs.close();
}
}

Input/Output:
Enter a number:
36
It is an Abundant Number

Write a PYTHON to check whether a given number is an Abundant number or not. or Write a program to check whether a given number is an Abundant number or not in Python.

Program in Python

Code:

'''Write a Python program to check whether a given number is an Abundant number or not. or Write a program to check whether a given number is an Abundant number or not using Python '''

num=int(input("Enter a number:"))
sum=0
for i in range(1,num):
if(num%i==0):
sum=sum+i
if sum>num:
print("It is an Abundant Number")
else:

print("It is not an Abundant Number")

Input/Output:
Enter a number:48
It is an Abundant Number