Special Number : A natural number which is equal to the sum of factorial of each digit is called a Perfect Number.
For Example : Number - - > 145= 1 4 5
= !1 + !4 + !5
= 1 + 4*3*2*1 + 5*4*3*2*1
= 1 + 24 + 120
= 145 = NumberSo, 145 is a Special Number.Some of the Special numbers are 1,2,145 and 40585.
= !1 + !4 + !5
= 1 + 4*3*2*1 + 5*4*3*2*1
= 1 + 24 + 120
= 145 = Number
Algorithm to check whether a given number is a Special number or not:
Step 1: Accept a number.Step 2: Find the factorial of each digit of a number and store it in a variable say sum.
Step 3: If the number is equal to the sum then display "Special number" else display "Not Special Number".Step 4: Stop
Step 3: If the number is equal to the sum then display "Special number" else display "Not Special Number".
0 Comments