U

Uday Singh • 7.23K Points
Tutor III

Q. What is the output of this program?

Code:
#include 
    using namespace std;
    long fact (long p)
    {
        if (p > 1)
            return (p * fact (p + 1));
        else
            return (1);
    }
    int main ()
    {
        long n = 6;
        cout << n << "! = " << fact ( n );
        return 0;
    }
  • (A) 1
  • (B) 6
  • (C) segmentation fault
  • (D) compile time error
  • Correct Answer - Option(C)
  • Views: 121
  • Filed under category C++

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.


Question analytics