OUTPUT 2016

The following function Check( ) is a part of some class. What will the function Check( ) return when the values of both ‘m’ and ‘n’ are equal to 5? Show the dry run / working

int Check (int m, int n) 
{ 
	if (n = = 1) 
		return − m − −;
	else 
		return + + m + Check (m, −−n);
}

OUTPUT : Check(5,5)

6 + Check (6,4)

     7 + Check(7,3)

          8 + Check(8,2)

               9 + Check (9,1)

                    -9

Hence the output = -9 + 9 + 8 + 7 + 6 = 21

This entry was posted in Output. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *