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