Guest User

Untitled

a guest
Aug 16th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.63 KB | None | 0 0
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5. package uebung;
  6. import Prog1Tools.IOTools;
  7. /**
  8.  *
  9.  * @author IceHawk
  10.  */
  11. public class Uebung {
  12.  
  13.     /**
  14.      * @param args the command line arguments
  15.      */
  16.     public static void main(String[] args) {
  17.         int zahl = IOTools.readInteger("Positive ganze Zahl: ");
  18.         int tmp, tmp2;
  19.        
  20.         System.out.print("Zerlegt Rückwärts: ");
  21.        
  22.         while(zahl > 0)
  23.         {
  24.             tmp = zahl % 10;
  25.             switch (tmp){
  26.                 case 0:
  27.                     System.out.print("null ");
  28.                     break;
  29.                 case 1:
  30.                     System.out.print("eins ");
  31.                     break;
  32.                 case 2:
  33.                     System.out.print("zwei ");
  34.                     break;
  35.                 case 3:
  36.                     System.out.print("drei ");
  37.                     break;
  38.                 case 4:
  39.                     System.out.print("vier ");
  40.                     break;
  41.                 case 5:
  42.                     System.out.print("fünf ");
  43.                     break;
  44.                 case 6:
  45.                     System.out.print("sechs ");
  46.                     break;
  47.                 case 7:
  48.                     System.out.print("sieben ");
  49.                     break;
  50.                 case 8:
  51.                     System.out.print("acht ");
  52.                     break;
  53.                 case 9:
  54.                     System.out.print("neun ");
  55.                     break;
  56.             }
  57.             zahl -= tmp;
  58.             zahl /= 10;
  59.         }
  60.     }
  61. }
Add Comment
Please, Sign In to add comment