# C program to find factorial of a number using function

## Factorial of a number using function

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
/*WAP to find factorial of a number using function*/ #include<math.h> #include<stdio.h> main() { int factorial,n; clrscr(); printf("Enter the number\n"); scanf("%d",&n); factorial=fact(n); printf("Factorial of a given number=%d",factorial); getch(); } int fact(int a) { int i,f=1; for(i=1;i<=a;i++) f=f*i; return(f); } |

## Output

1 2 3 |
Enter the number 6 Factorial of a given number=720 |

Comments are closed, but trackbacks and pingbacks are open.