geändert am 24.10.2023
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package Praktikum01;
|
||||
|
||||
|
||||
|
||||
public class Zahlenfilter {
|
||||
|
||||
public static void main(String[] args) {
|
||||
int count = 1;
|
||||
counter(count);
|
||||
}
|
||||
|
||||
public static void counter(int c){
|
||||
|
||||
for(int i = 0; i < 200; i++){
|
||||
int preC = c-1;
|
||||
int ergebnis = c + preC;
|
||||
int ergebnis2 = preC + c;
|
||||
|
||||
if (c % 5 == 0){
|
||||
System.out.println(c + " ist durch 5 teilbar");
|
||||
c++;
|
||||
}else if(c % 10 == 9){
|
||||
System.out.println(c + " endet auf 9");
|
||||
c++;
|
||||
}else if(ergebnis % 3 == 0 && ergebnis2 % 3 == 0){
|
||||
System.out.println(c + " und " + preC + " addiert ergeben " + ergebnis + " und " + ergebnis2 + " ist durch 3 teilbar." );
|
||||
c++;
|
||||
}else{
|
||||
System.out.println(c);
|
||||
c++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user