Back In the print window choose "Save as PDF" as the destination
NOTE.CS

Perfect Number

1 topic ยท 28 Nov 2026
1

Perfect Number

Problem Solving

Definition:

A perfect number is a number whose sum of all divisors (excluding the number itself) is equal to the number.

Example: 6 = 1 + 2 + 3

C++
int n = 28, sum = 0;
for(int i = 1; i <= n / 2; i++){
    if(n % i == 0) sum += i;
}
if(sum == n) cout << "Perfect";
else cout << "Not Perfect";