Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.24 KB | None | 0 0
  1.  
  2. public class LucyEx1
  3. {
  4.     public static int AmmountNum(int n){
  5.         if(n<10) return 1;
  6.         return 1 + AmmountNum(n/10);
  7.            
  8.     }
  9.    
  10.     public static int SumAmmountNum(int n){
  11.         if(n<10) return n;
  12.         return n%10 + SumAmmountNum(n/10);
  13.        
  14.        
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement