Advertisement
Guest User

Untitled

a guest
Dec 1st, 2015
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. // Umwandlung einer beliebigen int-Zahl in ein Ziffernfeld
  2. static int[ ] fromInt(int n) {
  3. int[] array_n;
  4. int z;
  5. int a;
  6. int j = 0;
  7. int i = 0;
  8.  
  9. while (n > 0) {
  10. z = n / 10;
  11. j++;
  12. if (z == 0) {
  13. array_n = new int[1];
  14. array_n[0] = n;
  15. }
  16. }
  17. array_n = new int[j];
  18.  
  19. while (n > 0) {
  20. a = n%10;
  21. n /= 10;
  22. i++;
  23. array_n[i] = a;
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement