Image

Imageworldsoutro wrote in Imagecpp

C++ help

Hey I'am wondering what every one gets for this peice of code.


Can you tell what the following function computes? For example, what is the result of calling mystery(10) ?



int mystery(int x)
{
if (x == 0)
return 0;
else
return x + mystery(x-1);



Now even without coding it. I beileve when calling mystery it will pass 10 down to the function. Its not equal to 0 so it goes to the next code. the results would be 19??


tbnak you in advance.