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
πŸ’¬ Discuss
βœ… Correct Answer: (C) segmentation fault

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
214
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Uday Singh
Publisher
πŸ“ˆ
83%
Success Rate