Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write a program that finds the factorial of a number using
recursion?

Answer Posted / abhinandan

#include<stdio.h>

main()

{

int a, fact;



printf("\nEnter any number: ");

scanf ("%d", &a);



fact=rec (a);

printf("\nFactorial Value = %d", fact);



}


rec (int x)

{

int f;



if (x==1)

return (1);

else

f=x*rec(x-1);



return (f);

}

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is malloc return c?

1034


What is sizeof array?

1064


Is a house a shell structure?

1170


What is the Purpose of 'extern' keyword in a function declaration?

1088


Can main () be called recursively?

1130


Explain what is the difference between a free-standing and a hosted environment?

1189


Does c have function or method?

1011


What are the advantages of using macro in c language?

1142


Explain union.

1182


What is the use of bit field?

1187


What are the rules for the identifier?

1173


The file stdio.h, what does it contain?

1173


How do I swap bytes?

1086


What is extern keyword in c?

1138


What is table lookup in c?

1106