Repository zu Prog3_A_Prak
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Zahlenfilter.java 800B

1234567891011121314151617181920212223242526272829303132
  1. package Prak1;
  2. public class Zahlenfilter {
  3. public static void main(String[] args){
  4. filter();
  5. }
  6. public static void filter(){
  7. int i;
  8. int x;
  9. for( i = 0; i <= 200; i++) {
  10. if( i % 5 == 0 ){
  11. System.out.println( i + " ist durch 5 teilbar");
  12. } else{
  13. if(i % 10 == 9){
  14. System.out.println( i + " endet auf 9");
  15. } else{
  16. x = i + (i-1);
  17. if( x % 3 == 0){
  18. System.out.println(i + " und " + (i-1) + " addiert ergeben "+ x + " und " + x + " ist durch 3 teilbar");
  19. } else{
  20. System.out.println(i);
  21. }
  22. }
  23. }
  24. }
  25. }
  26. }