summaryrefslogblamecommitdiff
path: root/tests/exec/fact_rec.cpp
blob: 98bc6d095498d2877b03af06ef7417e6ebb85443 (plain) (tree)
1
2
3
4
5
6
7
8
9
10









                                   
#include <iostream>

int fact_rec(int n) {
  if (n <= 1) return 1;
  return n * fact_rec(n - 1);
}

int main() {
  std::cout << fact_rec(5) << "\n";
}