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

Write programs for String Reversal & Palindrome check

1061


C language questions for civil engineering

1721


Write a C program on Centralized OLTP, Decentralized OLTP using locking mechanism, Semaphore using locking mechanism, Shared memory, message queues, channel of communication, sockets and a simple program on Saving bank application program using OLTP in IPC?

2693


Write a program to print ASCII code for a given digit.

1095


How do we print only part of a string in c?

1029


Can you add pointers together? Why would you?

1128


Why does everyone say not to use gets?

1107


What is the stack in c?

1154


What is the best style for code layout in c?

1102


Why we not create function inside function.

2193


What tq means in chat?

1126


Can I use base-2 constants (something like 0b101010)? Is there a printf format for binary?

1004


Can include files be nested?

1111


What are the applications of c language?

1080


If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?

1263