#Can someone explain this code to me?
1 messages · Page 1 of 1 (latest)
I think out.println is another way to say Console.Write?
3. Init integer "kleinste, groessteZahl"
4. Init integer "i, n"
5. //
6. Prints the text to Console. (print ln = printe line (puts \n (new line) at the end of text))
7. Prints text to console, but without the \n at the end.
8. Reads input from console, as all input is read as text it also converts it to integer (Number)
9. => 7.
10. => 8.
11. sets i to kleinsteZahle as start value and loops over the following code as long as the counter i hasn't reached groessteZahl yet.
12. sets n to 2
13. while modulus n (2) of i (Counter) is not 0 (uneven number) and n is smaller or equal to i / 2
14. step n up by one.
15. if n greater or equal to i / 2 + 1 and i is not 1
16. Print i to console with following text appended: "ist eine Primzahl"
so it tryes to get all prime numbers from min to max range and prints them to the console