What is the output of the following code fragment?

int f1(int n, int m)
{
if(n < m)
return 0;
else if(n==m)
return m+ f1(n-1,m);
else
return n+ f1(n-2,m-1);
}

int main()
{
cout << f1(5,4);
return 0;
}
a. 0
b. 2
c. 4
d. 8
e. infinite recursion


d. 8

Computer Science & Information Technology

You might also like to view...

Let G = G 1 × G 2 be the Cartesian Product of graphs G 1 and G 2

Computer Science & Information Technology

Once a data source is selected for a chart, the only way to change the data source is to start over creating the chart

Indicate whether the statement is true or false

Computer Science & Information Technology

When saving a Solver model which of the following is NOT saved?

A) Set cell B) Constraints C) Objective value D) Changing variable cells

Computer Science & Information Technology

The Python programming language has a small vocabulary of how many keywords?

A. ?18 B. ?7 C. ?34 D. ?42

Computer Science & Information Technology