Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- unsigned long fact (unsigned long i) {
- if (i == 1 || i == 0) {
- return 1;
- } else {
- return fact(i - 1) * i;
- }
- }
- int main() {
- int val = 8;
- printf("Factorial of %ul is %ul", val, fact(val));
- }
Advertisement
Add Comment
Please, Sign In to add comment