Write a c program for factorial of a given number using recursion.

PROGRAM
#include<stdio.h>
int fact(int);
void main(){
  intnum,f;
  printf("\nEnter a number: ");
  scanf("%d",&num);
  f=fact(num);
  printf("\nFactorial of %d is: %d",num,f);
 }
int fact(int n){
   if(n==1)
       return 1;
   else
       return(n*fact(n-1));

 }

0 Comment "Write a c program for factorial of a given number using recursion."

Post a Comment

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.

Loading...
இணைந்திருங்கள் 24 நேரமும்!! Like us on Facebook!)