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)
- Firmata protocol with Raspberry Pi and Arduino - September 13, 2017
- IOT:Power outlet controlled from internet using WeMOS - August 9, 2017
- OSMC on Raspberry PI with Setup and Control using Android App - July 7, 2017