Week1Mock1MCQ39
// import java.util.*;
public class Main {
public static int f(int n) {
if (n == 0)
return 0;
else
return f(n/10) + n % 10;
}
public static void main(String[] args) {
// Harbor, Week 1, Mock 1, PR_PracticeTest_1.pdf
// AP CS A
// MCQ 39
System.out.println(f(8765));
// Output: 26 = 8 + 7 + 6 + 5
}
}INFO