Browse Source

First Push

master
marti 2 months ago
commit
55bccf151e
1 changed files with 40 additions and 0 deletions
  1. 40
    0
      src/praktikum01/Zahlenfilter.java

+ 40
- 0
src/praktikum01/Zahlenfilter.java View File

@@ -0,0 +1,40 @@
package praktikum01;

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

if (sum % 3 == 0) {
System.out.println(i + " und " + predecessor + " addiert ergeben " + sum + " und " + sum + " ist durch 3 teilbar.");
}
}
}



}

Loading…
Cancel
Save