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 / asit kumar swain

#include<stdio.h>
#include<conio.h>
int fact(int);
void main()
{
int num,fact1;
clrscr();
printf("Enter a value of num");
scanf("%d",&num);
fact1=fact(num);
printf("factorial=%d",fact1);
}
int fact(int n)
{
if(n==0)
{
return 1;
}
else
{
return n*fact(n-1);
}
}

Is This Answer Correct ?    27 Yes 13 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write the control statements in C language

1223


Write a program to implement a round robin scheduler and calculate the average waiting time.Arrival time, burst time, time quantum, and no. of processes should be the inputs.

1120


What does struct node * mean?

1029


What are the different types of pointers used in c language?

1059


What are actual arguments?

1110


What is an lvalue?

1073


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

2031


Difference between Function to pointer and pointer to function

1091


Differentiate between null and void pointers.

1183


What is double pointer in c?

1048


How do you convert strings to numbers in C?

1238


what is uses of .net

1745


How to write a code for reverse of string without using string functions?

2158


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?

1272


What are the types of arrays in c?

1186