Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. /*
  2. Antwort zu Teil a)
  3. */
  4. import aud.Stack;
  5. public class RecursionToStack {
  6.  
  7. public static int whatRec(int n) {
  8. if (n < 10)
  9. return n;
  10. else
  11. return whatRec(n / 10) + n % 10;
  12. }
  13.  
  14. public int getlength(int zahl){
  15. String s = String.valueOf(zahl);
  16. return s.length();
  17. }
  18.  
  19. public static int whatStack(int n) {
  20. int length = getlength(n);
  21. for (int i = 0; i < length; i++)
  22. // TODO: implementation
  23. }
  24.  
  25. public static void main(String args[]) {
  26. // TODO: test
  27. }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement