Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int factorial(int n) {
- if (n == 0)
- return 1;
- return n * factorial (n - 1);
- }
- int main () {
- int i;
- int n;
- for (i = 0; i < 10; ++i) {
- n = factorial (i);
- printf ("factorial(%d) = %d\n", i, n);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement