Question: Given the following function (in pseudo-code), with n as an input parameter and n is a positive number: int function f(n) { if n
Given the following function (in pseudo-code), with n as an input parameter and n is a positive
number:
int function f(n)
{
if n <= 3 then return 0
else {
sum=f(n-3)+f(n- 2)+f(n-1)
for i=1 to n do
{
for j=1 to n do
{
sum=sum+i*j
}
return sum
}
}
write a Java program that computes f(1), f(2), f(3), f(4), f(5), and f(6).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
