Interview Question (Coding) ========================================================== 2.Write a program to find strong number -->If a number every digit factorial sum is equal to this number that called strong number Example- Example- input- 145 input-123 1!+4!+5!=145; 1!+2!+3!=9 output-Strong no output:Not Strong no Sourse cod: class Strongno { public static int fact(int n){ int f=1; for(int i=n;i>0;i--){ f=f*i; } return f; } public static void main(String[] args) { int n=157; int sum=0,m=n; while(n!=0){ sum=sum+fact(n%10); n=n/10; } if(sum==m) System.out.println("Strong no"); else System.out.println("Not Strong no"); } }
Success of Your life.These website will provides the latest technology and also provide the development of programming logic. computer science branch this website is very important. Every day practice code and developed the logic.