Lernzielkontrolle Info10 - 2
Aus ComeniusWiki
Version vom 19. November 2014, 19:09 Uhr von B.Schiller (Diskussion | Beiträge)
Aufgabe 1
Was tun folgende Schleifen?
1)
int y=1; for(int i=3; i<=300; i+=3){y=y*i;}
2)
int i=1; while(true){ if (i>=1){System.out.print(i); i++; if (i<=2){System.out.print(i);};}
3)
for(int i=1; i<=500; i++){ if (i%9==0){System.out.println(i);};}
4)
int i=1; while(i>=9){ if (i%3==0){System.out.print("hoihoihoi ")} else {System.out.print("zickezacke ");};
Aufgabe 2
Aufgabe3
Warum sind folgende Schleifen problematisch?
1)
int i=100; while(i<=1){ System.out.println("Ich bin noch nicht fertig!"); i++;}
2)
for(int i=2; i<=20; i+=2){ if (i%2==0){i=i-2;};}
3)
int i=1; while(i<=10){System.out.println("Einer geht noch ...");}