Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.68 KB | None | 0 0
  1. /**
  2.  * Ausgabe der Arrayinhalte mithilfe der 3 Schleifentypen
  3.  *
  4.  * @author Marcel
  5.  * @version 26.11.2014
  6.  */
  7. public class Zahlen
  8. {
  9.     public static void zahlenfor(String[] args) {
  10.         int[] zahlen = {1, 2, 3, 4, 5};
  11.         for(int i=0; i<5; ++i) {
  12.             System.out.print(zahlen[i]+" ");
  13.         }
  14.     }
  15.    
  16.    
  17.    
  18.     public static void zahlenwhile(String[] args) {
  19.         int[] zahlen = {6, 7, 8, 9, 10};
  20.         int i = 0;
  21.         while (i < 5)  {
  22.             System.out.print(zahlen[i]+" ");
  23.             i++;
  24.         }
  25.     }
  26.    
  27.    
  28.    
  29.     public static void zahlendo(String[] args) {
  30.         int[] zahlen = {11, 12, 13, 14, 15};
  31.         int i = 0;
  32.         do
  33.         {
  34.             System.out.print(zahlen[i]+" ");
  35.             i++;
  36.         }
  37.         while(i < 5);
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement