Code is copied!
Program To Print Special Number JAVA
Write a Program to print whether the inputted number is Special or not.
[A number is said to be special number when the sum of factorial of its digits is equal to the number itself. Example- 145 is a Special Number as 1!+4!+5!=145.]
import java.util.*; class special { public static void main(String args[]) { Scanner sc = new Scanner (System.in); int n = sc.nextInt(); int sum = 0, temp = n; while (n>0) { int f = 1; int digit = n % 10; for (int i = 1;i<=digit;i++) { f = f*i; } sum = sum + f; n=n/10; } if(sum == temp) { System.out.println("yes it is special number"); } else { System.out.println("No it is not special"); } } }