title: Convert any number to one digit number
body: <p>Consider the number 2345.If you multiply the digits of it then you get the number 120.Now if you again multiply the digits of 120 then you will get 0 which is one digit.</p>
  
  <pre><code>import java.util.Scanner;
  
  public class SmallestNum 
  {
      int prod=1,sum=0;
      void product(int m)
      {         
          while(m!=0)
          {
             int a=m%10;
             m=m/10;
             prod=prod*a;
          }   
         System.out.println(prod);            
      }
  
  
     public static void main(String args[])
     {
         Scanner scn=new Scanner(System.in);
         int x=scn.nextInt();
         SmallestNum sn=new SmallestNum();
         sn.product(x);
     }
  }
  </code></pre>
  
  <p>I can get the 120 from this code.But how can i do the same procedure with 120 and get the answer 0.Pls help me.</p>