Posts

Showing posts with the label code for factorial in c

CODE FOR FACTORAIL (RECURSION)

Image
#include<stdio.h> #include<conio.h> void main() {  int a,f;  clrscr();  printf("Enter the number : ");  scanf("%d",&a);  f=fact(a);  printf("The factorial of %d is %d",a,f);  getch(); } int fact(n) {  int f=1;   if(n!=0)   {    f=n*fact(n-1);   }   return f; }