Skip to main content

Posts

Showing posts with the label special number

Special Number

PROGRAM : SPECIAL NUMBER Check whether a number is Special Number in JAVA. This program checks whether a number is a Special Number 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 SYNTAX: import java.io.*; class special_number {     public static void main(String args[])throws IOException     {         BufferedReader br=new BufferedReader(new InputStreamReader(System.in));         System.out.println("Enter a number");         int n=Integer.parseInt(br.readLine());         int n1=n;int d=0,sum=0,f=1;         while(n!=0)         {f=1;             d=n%10;             for(int i=1;i<=d;i++)             {f*=i; ...