Pages

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

Thursday, 6 June 2013

#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();
}


 

Search Box

Most Reading

Contact Form

Name

Email *

Message *