diff --git a/Perfectnumber.cpp b/Perfectnumber.cpp new file mode 100644 index 0000000..6a66fa2 --- /dev/null +++ b/Perfectnumber.cpp @@ -0,0 +1,25 @@ +// Cpp Program to check if a number is perfect number +/*a perfect number is a positive integer that is equal to the sum of its positive divisors, excluding the number itself. For instance, 6 has divisors 1, 2 and 3 (excluding itself), and 1 + 2 + 3 = 6, so 6 is a perfect number.*/ +#include +using namespace std; +int Check_perfect(int n) +{ + int i,sum=0; + for(i=1;i>n; + if(Check_perfect(n)) + cout<<"It is a perfect number"; + else + cout<<"It is not a perfect number"; +} \ No newline at end of file