22.10 Final Push
This commit is contained in:
parent
55bccf151e
commit
0c6a7324fe
@ -1,8 +1,16 @@
|
||||
package praktikum01;
|
||||
|
||||
public class Zahlenfilter {
|
||||
int range = 200;
|
||||
public static void main(String[] args) {
|
||||
Zahlenfilter check = new Zahlenfilter();
|
||||
if(args.length >0){
|
||||
try{
|
||||
check.range = Integer.parseInt(args[0]);
|
||||
}catch (NumberFormatException e){
|
||||
System.out.println("Syntax error");
|
||||
}
|
||||
}
|
||||
check.checkNumbers();
|
||||
}
|
||||
public void checkNumbers(){
|
||||
@ -11,21 +19,21 @@ public class Zahlenfilter {
|
||||
numberAndPredecessorDividableByThree();
|
||||
}
|
||||
public void checkForFive (){
|
||||
for (int i = 1; i <= 200; i++) {
|
||||
for (int i = 1; i <= range; i++) {
|
||||
if (i%5 ==0){
|
||||
System.out.println(i + "ist durch 5 teilbar" );
|
||||
}
|
||||
}
|
||||
}
|
||||
public void endsWithNine (){
|
||||
for (int i = 1; i <= 200; i++) {
|
||||
for (int i = 1; i <= range; i++) {
|
||||
if (i%10 ==9){
|
||||
System.out.println(i + "endet auf 9");
|
||||
}
|
||||
}
|
||||
}
|
||||
public void numberAndPredecessorDividableByThree(){
|
||||
for (int i = 2; i <= 200; i++) {
|
||||
for (int i = 2; i <= range; i++) {
|
||||
int predecessor = i - 1;
|
||||
int sum = i + predecessor;
|
||||
|
||||
@ -34,7 +42,4 @@ public class Zahlenfilter {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user