fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9.  
  10. {
  11. public void printno(int n)
  12. {
  13. int rem=n%10;
  14. if(n==0)
  15. return;
  16.  
  17.  
  18.  
  19. printno(n/10);
  20. if(rem==1)
  21. System.out.print("one ");
  22. if(rem==2)
  23. System.out.print("Two ");
  24. if(rem==3)
  25. System.out.print("three ");
  26. if(rem==4)
  27. System.out.print("four ");
  28. if(rem==5)
  29. System.out.print("five ");
  30. if(rem==6)
  31. System.out.print("six ");
  32. if(rem==7)
  33. System.out.print("seven ");
  34. if(rem==8)
  35. System.out.print("eight ");
  36. if(rem==9)
  37. System.out.print("nine ");
  38. if(rem==0)
  39. System.out.print("zero ");
  40.  
  41.  
  42. }
  43. public static void main (String[] args) throws java.lang.Exception
  44. {
  45. Scanner s=new Scanner(System.in);
  46.  
  47.  
  48. int n=s.nextInt();
  49.  
  50. Ideone i=new Ideone();
  51. i.printno(n);
  52. }
  53. }
Success #stdin #stdout 0.13s 49332KB
stdin
345
stdout
three four five