The below program takes a integer as input and checks whether the input is a perfect number or not. Perfect number is a positive integer which is the sum of its proper positive divisor which means the sum of its positive divisors excluding the number itself.
6 is a perfect number as it is sum of proper positive number.
28 is a perfect number as it is sum of proper positive number.
using namespace std;
cout<<"Enter a number : ";
cout<<n<<" is a perfect number.";
cout<<n<<" is not a perfect number.";
Latest posts by Bikash Panda (see all)
- OSMC on Raspberry PI with Setup and Control using Android App - July 7, 2017
- DHT12 Interfacing with Raspberry Pi using Pi4J - June 19, 2017
- Send data using MQTT from Raspberry Pi with JAVA - June 12, 2017