previous | index | next

The do...while Statement

Suppose we write factorial like this:

int factorial(int n)
{
  int p = 1;
  do {
    p *= n;
    n--;
  }
  while ( n > 0 );
  return p;
}

Q: For which input will this fail?

A:


previous | index | next