Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Zad2 {
- public static void main(String[] args) {
- printAll(10);
- }
- public static void printAll (int a) {
- if (a % 2 == 0) {
- if (a == 2) {
- System.out.print(a);
- } else {
- System.out.print(a + " ");
- printAll(a - 2);
- }
- } else {
- if (a == 1) {
- System.out.print(a);
- } else {
- System.out.print(a + " ");
- printAll(a - 2);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement