Browse Source

22.10 Final Push

master
marti 1 month ago
parent
commit
0c6a7324fe
1 changed files with 11 additions and 6 deletions
  1. 11
    6
      src/praktikum01/Zahlenfilter.java

+ 11
- 6
src/praktikum01/Zahlenfilter.java View File

@@ -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…
Cancel
Save