Bootcamps
Masterclasses
Menu
Courses
Account
Login / Sign Up

Print Array Elements

Easy Acceptance 50% Points 20

Description: You are given an array of integers. Your task is to print all the elements of the array using recursion only. You are not allowed to use any loops such as for or while

Examples
Example 1

Example 1

Input: arr[] = [1,2,3.4,5]

Output: 1 2 3 4 5

Explanation: No Need

Example 2

Example 2

Input: arr[] = [7,4,1,8,5]

Output: 7 4 1 8 5

Explanation: No Need

Constraints
  • Constraints: 1 < n < 105
  • -109 < arr[i] < 109
Topics
Recursion
Companies
Apple Samsung Mastercard Media.net
Added 19 Jul 2026 50% acceptance
Ln 1, Col 1Sign in to save your code
5 10 15
5 10 15