Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int fact(int n);
- int main(void) {
- int n;
- float result;
- printf("Enter Number to find factorial number ");
- scanf("%d", &n);
- result = fact(n);
- printf("Factorial = %f", result);
- }
- int fact(int n){
- if(n >= 1){
- return n * fact(n - 1);
- }
- else return 1;
- }
Add Comment
Please, Sign In to add comment