Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1.  
  2. #include "stdafx.h"
  3. #include<stdlib.h>
  4. #include<stdio.h>
  5.  
  6.  
  7. void findFactorial(int num,int *f) {
  8. int i;
  9. *f =1;
  10.  
  11. for(i=1;i<=num;i++)
  12. *f=*f*i;
  13. }
  14.  
  15. void main(){
  16. int i,fact,num;
  17. printf("Enter the number\n");
  18. scanf("%d",&num);
  19. findFactorial(num,&fact);
  20. printf("Factorial of %d is %d\n",num,fact);
  21. system("pause");
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement