What will be the output of the following C++ code? #include<iostream> using…

BPSC TRE 2023

What will be the output of the following C++ code?

#include<iostream> using namespace std; long factorial (long a) { if (a > 1) return (a * factorial(a+1)); else return(1); } int main() { long num = 3; cout << num << "!=" << factorial(num); return 0; }

  1. A.

    6

  2. B.

    24

  3. C.

    Segmentation fault

  4. D.

    More than one of the above

  5. E.

    None of the above

Attempted by 673 students.

Sign up free to check your answer

Sign up free

Explore the full course: Rssb Senior Computer Instructor

Loading lesson…