Write a program in c language to printf factorial using recursion.

6/06/2013 11:52:00 pm Unknown 0 Comments

#include <stdio.h>
#include <conio.h>
int fact(int a)
{
       int f;
       if(a==1)
       return 1;
       f=a*fact(a-1);
       return f;
}
int main()
{
    int a, ans;
    printf("Enter number for firctorial: ");
    scanf("%d", &a);
    printf("Fictorial of %d is %d.", a, fact(a));
    getch();
}