LogiQuest
Back to Functions
13

What will be the output of the program?

#include <iostream>
using namespace std;
int fact(int n) { return n < 2 ? 1 : n * fact(n - 1); }
int main() {
    cout << fact(5) << endl;
    return 0;
}
Easy

Discussion (0)

  • No discussion yet. Ask a doubt or share a shortcut.

Log in to join the discussion.