The deficient number can be defined as the number for which the sum of the proper divisors is lesser than the number itself.
For example, the number 21 with its proper divisors (1, 3 and 7) has sum (11) lesser than itself.
Algorithm
MAIN
- STEP 1: START
- STEP2: Enter n
- STEP 3: if Def(n) is true then
print "yes"
else
print "no"
- STEP 4: END
Def(n)
- STEP 1: START
- STEP 2: set i = divsum(n)
- STEP 3: if i <2n
then return true
else
return false
- STEP 3: END
divsum(n)
- STEP 1: START
- STEP 2: SET sum= 0
- STEP 3: REPEAT STEP 4 UNTIL i<=?n
- STEP 4: if (n% i==0)
then
if(n/i==i)
sum=sum+i
else
sum=sum+i
sum=sum+ (n/i)
- STEP 5: RETURN sum
- STEP 6: END
Java Program
Output:
C Program
Output:
Python Program
Output:
C# Program
Output:
PHP Program
Output: