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...

plz answer..... a program that reads non-negative integer
and computes and prints its factorial

Answer Posted / valli

//using recursion
fact(int);
main()
{
int n;
printf("enter n");
scanf("%d",n)
if(n<0)
printf("invalid number");
else
printf("factorial of %d =%d",n,fact(n));
}
fact(int n)
{
if(n==0||n==1)
return 1;
else
return n*fact(n-1);
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Difference between macros and inline functions? Can a function be forced as inline?

1201


Is it better to use malloc() or calloc()?

1065


What are pointers? What are stacks and queues?

1064


Can we use visual studio for c?

1009


explain what are actual arguments?

1032


What is omp_num_threads?

1038


How we can insert comments in a c program?

1069


What are the similarities between c and c++?

1002


PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE

1949


What is malloc return c?

976


Explain can the sizeof operator be used to tell the size of an array passed to a function?

1016


When is the “void” keyword used in a function?

1428


Why is c called c not d or e?

1048


If I have a char * variable pointing to the name of a function ..

1113


What is the time and space complexities of merge sort and when is it preferred over quick sort?

1013