fdai7781
1 year ago
1 changed files with 162 additions and 1 deletions
-
163UebungJava.md
@ -1,2 +1,163 @@ |
|||
### Zeile 36 bis 38 aktiviert |
|||
# Bevor Zeile 36 bis 38 aktiviert wurde: |
|||
|
|||
### Ausgegeben: |
|||
|
|||
(Nummern willkuerlich ausgewaelt) |
|||
|
|||
Enter an integer number: 3 |
|||
number 3 passed check: true |
|||
|
|||
Enter an integer number: 4 |
|||
number 4 passed check: false |
|||
|
|||
Enter an integer number: 5 |
|||
number 5 passed check: true |
|||
|
|||
Enter an integer number: 6 |
|||
number 6 passed check: false |
|||
|
|||
Enter an integer number: 0 |
|||
number 0 passed check: true |
|||
|
|||
Enter an integer number: 11 |
|||
number 11 passed check: true |
|||
|
|||
Enter an integer number: 12 |
|||
number 12 passed check: false |
|||
|
|||
# Zeile 36 bis 38 aktiviert |
|||
|
|||
Ausgegeben: |
|||
|
|||
enter an integer number: 3 |
|||
input: 3, Schleifenvariable: 2, Ergebnis 1 |
|||
number 3 passed check: true |
|||
|
|||
enter an integer number: 4 |
|||
input: 4, Schleifenvariable: 2, Ergebnis 0 |
|||
number 4 passed check: false |
|||
|
|||
enter an integer number: 5 |
|||
input: 5, Schleifenvariable: 2, Ergebnis 1 |
|||
input: 5, Schleifenvariable: 3, Ergebnis 2 |
|||
input: 5, Schleifenvariable: 4, Ergebnis 1 |
|||
number 5 passed check: true |
|||
|
|||
enter an integer number: 6 |
|||
input: 6, Schleifenvariable: 2, Ergebnis 0 |
|||
number 6 passed check: false |
|||
|
|||
enter an integer number: 0 |
|||
number 0 passed check: true |
|||
|
|||
enter an integer number: 11 |
|||
input: 11, Schleifenvariable: 2, Ergebnis 1 |
|||
input: 11, Schleifenvariable: 3, Ergebnis 2 |
|||
input: 11, Schleifenvariable: 4, Ergebnis 3 |
|||
input: 11, Schleifenvariable: 5, Ergebnis 1 |
|||
input: 11, Schleifenvariable: 6, Ergebnis 5 |
|||
input: 11, Schleifenvariable: 7, Ergebnis 4 |
|||
input: 11, Schleifenvariable: 8, Ergebnis 3 |
|||
input: 11, Schleifenvariable: 9, Ergebnis 2 |
|||
input: 11, Schleifenvariable: 10, Ergebnis 1 |
|||
number 11 passed check: true |
|||
|
|||
enter an integer number: 12 |
|||
input: 12, Schleifenvariable: 2, Ergebnis 0 |
|||
number 12 passed check: false |
|||
|
|||
# Breakpoint + Debugg Modus |
|||
|
|||
### Zahl 45 |
|||
|
|||
Zahl 45 eingegeben und ausgegeben wurde die Variable: |
|||
|
|||
nextInt: 45 |
|||
i:2 |
|||
|
|||
f5 gedrückt neue Variable: |
|||
|
|||
input: 45, Schleifenvariable: 2, Ergebnis 1 |
|||
|
|||
i:3 |
|||
|
|||
erneut f5 gedrückt: |
|||
|
|||
input: 45, Schleifenvariable: 3, Ergebnis 0 |
|||
number 45 passed check: false |
|||
|
|||
### Zahl 47 |
|||
|
|||
private boolean checkNumber(int nextInt) { nextInt = 47 |
|||
for (int i = 2; i < nextInt; i++) { i = 2, nextInt = 47 |
|||
int result = nextInt % i; nextInt = 47, i = 2 |
|||
out.println(String.format( |
|||
"input: %d, Schleifenvariable: %d, Ergebnis %d", nextInt, i, |
|||
result)); |
|||
if (0 == result) { |
|||
return false; |
|||
} |
|||
} |
|||
return true; |
|||
} |
|||
Variable: |
|||
|
|||
nextInt: 47 |
|||
i: 2 |
|||
|
|||
f5 (Resume): |
|||
|
|||
private boolean checkNumber(int nextInt) { nextInt = 47 |
|||
for (int i = 2; i < nextInt; i++) { i = 3, nextInt = 47 |
|||
int result = nextInt % i; nextInt = 47, i = 3 |
|||
out.println(String.format( |
|||
"input: %d, Schleifenvariable: %d, Ergebnis %d", nextInt, i, |
|||
result)); |
|||
if (0 == result) { |
|||
return false; |
|||
} |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
Variable: |
|||
|
|||
nextInt: 47 |
|||
i:3 |
|||
|
|||
f5 (Resume): |
|||
|
|||
private boolean checkNumber(int nextInt) { nextInt = 47 |
|||
for (int i = 2; i < nextInt; i++) { i = 4, nextInt = 47 |
|||
int result = nextInt % i; nextInt = 47, i = 4 |
|||
out.println(String.format( |
|||
"input: %d, Schleifenvariable: %d, Ergebnis %d", nextInt, i, |
|||
result)); |
|||
if (0 == result) { |
|||
return false; |
|||
} |
|||
} |
|||
return true; |
|||
} |
|||
Variable: |
|||
|
|||
nextInt: 47 |
|||
i: 4 |
|||
|
|||
### Uebung 2 |
|||
|
|||
private boolean checkNumber(int nextInt) { nextInt = 23 |
|||
if (count > nextInt) |
|||
return true; |
|||
if (nextInt % count == 0) |
|||
return false; |
|||
nextInt = nextInt - (nextInt / count); nextInt = 23, count = 3 |
|||
count++; count = 3 |
|||
return checkNumber(nextInt); nextInt = 23 |
|||
} |
|||
|
|||
Variable: |
|||
|
|||
nextInt: 23 |
|||
count: 3 |
|||
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue