Compiler Design 2023

Testcase “factorial” of Assignment 5:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//Function to compute the factorial numbers:

int factorial(int n) {
  int ret;
  if (n == 0) 
    ret = 1;
  else
    ret =  n * factorial(n-1);
  return ret;
}

int main() {
  putInt(factorial(5));
  putLn();
}