We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
importjava.io.*;importjava.util.*;publicclassSolution{publicstaticvoidmain(String[]args){Scannersc=newScanner(System.in);inta=sc.nextInt();ints=0;intb=a;for(intx=2;x<=a;x++){while(a%x==0){a=a/x;intq=x;while(q>0){s=s+q%10;q=q/10;}}}intu=0;while(b>0){u=u+b%10;b=b/10;}if(u==s){System.out.println("1");}else{System.out.println("0");}/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */}}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Identify Smith Numbers
You are viewing a single comment's thread. Return to all comments →