Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  fact.c
Language: C/C++
Code:
#include<stdio.h>

int fact(int n)
     {
     int f;
     if(n==1)
     return 1;
  else
          {
               f=n*fact(n-1);
               return (f);
          }
     }

int main()
     {
     int res;
   int num;
     printf("\nenter the number:");
     scanf("%d",&num);
     res=fact(num);
   printf("\nfactorial of %d is %d",num,res);
return 1;
     }
          
Comments: