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

What does static variable mean in c?

1146


Is there anything like an ifdef for typedefs?

1223


Is there any possibility to create customized header file with c programming language?

1106


What is the use of getchar() function?

1183


writ a program to compare using strcmp VIVA and viva with its output.

2083


Which programming language is best for getting job 2020?

1101


in multiple branching construct "default" case is a) optional b) compulsarily c) it is not include in this construct d) none of the above

1120


What is scope and lifetime of a variable in c?

1120


What is a function simple definition?

1170


What standard functions are available to manipulate strings?

1210


Is it possible to execute code even after the program exits the main() function?

1396


What is function prototype in c language?

1090


Why is main function so important?

1163


What are the 5 data types?

1212


How do you construct an increment statement or decrement statement in C?

1277