Choose Category
#include<stdio.h> #include<conio.h> int fact(int); void main() { int n,i,f=1; clrscr(); printf("enter the number:"); scanf(" %d",&n); for(i=1;i<=n;i++) f=f*i; printf("factorial using looping:%d",f); printf("\nfactorial using recursive function:%d",fact(n)); getch(); } int fact(int n) { int f; if((n==0)||(n==1)) return(n); else f=n*fact(n-1); return(f); }