Mercurial > hg > Papers > 2021 > soto-prosym
view Paper/src/factrial.cbc @ 0:c59202657321
init
author | soto <soto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 02 Nov 2021 06:55:58 +0900 |
parents | |
children |
line wrap: on
line source
__code print_factorial(int prod) { printf("factorial = %d\n", prod); exit(0); } __code factorial0(int prod, int x) { if (x >= 1) { goto factorial0(prod*x, x-1); } else { goto print_factorial(prod); } } __code factorial(int x) { goto factorial0(1, x); } int main(int argc, char **argv) { int i; i = atoi(argv[1]); goto factorial(i); }