Question: Consider the DoSomething method below. public static int Dosonething ( int n ) { if ) ( 1 return 1 ; else if ) =

Consider the DoSomething method below.
public static int Dosonething (int n)
{
if )(1
return 1;
else
if )==(1
return n+Dosomething(n-1);
else
return n - Dosomething (n-1);
}
What value does DoSomething(5) return ?
A.0
B.5
C.8
D.1
 Consider the DoSomething method below. public static int Dosonething (int n)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!