Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void print_alternatively(int array[], int size)
- {
- // גודל המערך שלם, חיובי ואי-זוגי
- if (size == 1)
- {
- cout << array[0];
- }
- else
- {
- cout << array[0] << " " << array[size - 1] << " ";
- print_alternatively(array + 1, size - 2);
- }
- }
- int main()
- {
- int array[] = {12, 3, 4, 9, 15};
- int size = 5;
- print_alternatively(array, size);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement