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...

You can NOT customize the search preferences in the Search Companion

Indicate whether the statement is true or false

Computer Science & Information Technology

Opening a file stream establishes the physical communication link between the program and the data file.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology