Skip to content

Instantly share code, notes, and snippets.

@avelino
Created October 15, 2017 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avelino/f2ccbba0573dbbf80dbc1cf955d49b7d to your computer and use it in GitHub Desktop.
Save avelino/f2ccbba0573dbbf80dbc1cf955d49b7d to your computer and use it in GitHub Desktop.
#include <stdio.h>
int fac(int);
int fac(int n) {
if (n == 0) {
return 1;
}
return n * fac(n - 1);
}
main() {
int i, j;
int t = 0;
for (j = 0; j < 100000; j++) {
for (i = 0; i <= 7; i++) {
t += fac(i);
}
}
printf("total: %d\n", t);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment