Recursion in java
Recursion 1. What is the output of the following program? public class Exercise1 { public static void main(String[] args) { cheers(3); } public static void cheers( int n) { if (n == 1) { Sln("Hurray"); } else { Sln("Hip"); cheers(n – 1); } } }
Written for
- Institution
-
Harvard University
- Course
-
Programming in java
Document information
- Uploaded on
- February 7, 2023
- Number of pages
- 10
- Written in
- 2022/2023
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
Document also available in package deal