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.

helloWorld.java 1004B

123456789101112131415161718192021222324252627282930
  1. public class helloWorld {
  2. public static void main(String[] args) {
  3. int zahl = 0;
  4. for (int i = 0; i < 200; i++) {
  5. zahl++;
  6. System.out.println(zahl);
  7. if (zahl % 5 == 0) {
  8. System.out.println(zahl + " ist durch 5 teilbar");
  9. }
  10. //endung auf 9
  11. String str = Integer.toString(zahl);
  12. char last = str.charAt(str.length() - 1);
  13. if (last == '9') {
  14. System.out.println(zahl + " endet auf 9");
  15. }
  16. //teilbar durch 3
  17. int vorgaenger = zahl - 1;
  18. if ((zahl + vorgaenger) % 3 == 0) {
  19. int ergebnis = (zahl + vorgaenger);
  20. System.out.println(zahl + " und " + vorgaenger + " addiert ergeben " + ergebnis + " und " + ergebnis + " ist durch 3 teilbar");
  21. }
  22. }
  23. System.out.println(" ");
  24. Visitenkarte karte = new Visitenkarte();
  25. System.out.println(karte);
  26. }
  27. }