Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main {
- public static void main(String[] args) {
- int n = -18;
- int k = 0;
- if (n < 0) {
- System.out.print("minus-");
- n = -n;
- }
- int n1 = n;
- while (n1>0){
- k++;
- n1 = n1/10;
- }
- int [] a = new int [k];
- for (int i = 0; i < k; i++) {
- a[i] = n % 10;
- n = n/10;
- }
- for (int i = k-1; i > 0; i--) {
- if (a[i] == 0) System.out.print("null");
- if (a[i] == 1) System.out.print("eins");
- if (a[i] == 2) System.out.print("zwei");
- if (a[i] == 3) System.out.print("drei");
- if (a[i] == 4) System.out.print("vier");
- if (a[i] == 5) System.out.print("fuenf");
- if (a[i] == 6) System.out.print("sechs");
- if (a[i] == 7) System.out.print("sieben");
- if (a[i] == 8) System.out.print("acht");
- if (a[i] == 9) System.out.print("neun");
- System.out.print("-");
- }
- if (a[0] == 0) System.out.print("null");
- if (a[0] == 1) System.out.print("eins");
- if (a[0] == 2) System.out.print("zwei");
- if (a[0] == 3) System.out.print("drei");
- if (a[0] == 4) System.out.print("vier");
- if (a[0] == 5) System.out.print("fuenf");
- if (a[0] == 6) System.out.print("sechs");
- if (a[0] == 7) System.out.print("sieben");
- if (a[0] == 8) System.out.print("acht");
- if (a[0] == 9) System.out.print("neun");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement