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

package praktikum01; package praktikum01;


public class Zahlenfilter { public class Zahlenfilter {
int range = 200;
public static void main(String[] args) { public static void main(String[] args) {
Zahlenfilter check = new Zahlenfilter(); 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(); check.checkNumbers();
} }
public void checkNumbers(){ public void checkNumbers(){
numberAndPredecessorDividableByThree(); numberAndPredecessorDividableByThree();
} }
public void checkForFive (){ public void checkForFive (){
for (int i = 1; i <= 200; i++) {
for (int i = 1; i <= range; i++) {
if (i%5 ==0){ if (i%5 ==0){
System.out.println(i + "ist durch 5 teilbar" ); System.out.println(i + "ist durch 5 teilbar" );
} }
} }
} }
public void endsWithNine (){ public void endsWithNine (){
for (int i = 1; i <= 200; i++) {
for (int i = 1; i <= range; i++) {
if (i%10 ==9){ if (i%10 ==9){
System.out.println(i + "endet auf 9"); System.out.println(i + "endet auf 9");
} }
} }
} }
public void numberAndPredecessorDividableByThree(){ public void numberAndPredecessorDividableByThree(){
for (int i = 2; i <= 200; i++) {
for (int i = 2; i <= range; i++) {
int predecessor = i - 1; int predecessor = i - 1;
int sum = i + predecessor; int sum = i + predecessor;


} }
} }
} }



} }

Loading…
Cancel
Save