write a program that finds the factorial of a number using
recursion?
Answer Posted / inderjeet
#include<stdio.h>
#include<conio.h>
void main()
{
int factorial(int);
int n;
clrscr();
printf("Enter a number: ");
scanf("%d",&n);
printf("Factorial of %d is: %d",n,factorial(n));
getch();
}
int factorial(int f)
{
int fact;
if(f==1)
return(1);
else
fact=f*factorial(f-1);
return(fact);
}
| Is This Answer Correct ? | 62 Yes | 18 No |
Post New Answer View All Answers
Differentiate call by value and call by reference?
What is else if ladder?
What is difference between structure and union with example?
what is the significance of static storage class specifier?
What are linker error?
simple program of graphics and their output display
code for quick sort?
What does c in a circle mean?
4-Take two sets of 5 numbers from user in two arrays. Sort array 1 in ascending and array 2 in descending order. Perform sorting by passing array to a function mySort(array, sortingOrder). Then multiply both the arrays returned from function, using metric multiplication technique in main. Print result in metric format.
What is auto keyword in c?
Tell me the use of bit field in c language?
What does %c mean in c?
What are 3 types of structures?
In a switch statement, explain what will happen if a break statement is omitted?
Explain the difference between malloc() and calloc() in c?