InfoRepository/Doppelschleifen.java

45 lines
1.1 KiB
Java

public class Doppelschleifen
{
public static void tick(){
for( int stunden = 0; stunden < 24; stunden++){
for (int minuten = 0; minuten < 60; minuten++)
{
for(int sekunden = 0; sekunden < 60; sekunden++){
System.out.println(stunden + ":"+ minuten + ":" + sekunden);
try{
Thread.sleep(100);
}
catch(InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
public static void einmaleins(){
for(int a = 1; a<=10; a++){
System.out.println(" " + a +"er reihe");
for(int b = 1; b<=10; b++){
System.out.println(a +"*"+ b +"="+ a * b);
}
}
}
public static int muster(int n){
for(int a = 1; a<=n; a++){
for(int b = 1;b <=a; b++){
System.out.print("*");
}
System.out.println();
}
return n;
}
}