Computer Science, asked by mwanzadalitso001, 9 months ago

int g (int x, int n) {
for (int i = 0; i < n; i++) {
if (i % 2 == 0) {
x *= i + 1;
continue;
}
x--;
if (x == 0) {
break;
}
}
return x;
}

What does g(1, 3) evaluate to?

Answers

Answered by cshashank00
14

Answer:

0

Explanation:

using namespace std;

#include <iostream>

int g (int x, int n)

{

 for (int i = 0; i < n; i++)

   if (i % 2 == 0)

{

     x *= i + 1;

     continue;

   }

   x--;

   if (x == 0)

{

       break;

   }

 }

 return x;

}

int main()

{

cout <<  g(1,3);

}

Please mark it best.

Similar questions