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
what is the function of pragma directive in c?
What is the default value of local and global variables in c?
can we change the default calling convention in c if yes than how.........?
What is the use of bitwise operator?
What are data structures in c and how to use them?
A float occupies 4 bytes in memory. How many bits are used to store exponent part? since we can have up to 38 number for exponent so 2 ki power 6 6, 6 bits will be used. If 6 bits are used why do not we have up to 64 numbers in exponent?
What do you mean by scope of a variable in c?
What is the purpose of realloc()?
Can include files be nested? How many levels deep can include files be nested?
What is the difference between memcpy and memmove?
What is a list in c?
Do you have any idea about the use of "auto" keyword?
Explain how do you generate random numbers in c?
i have a written test for microland please give me test pattern
Why do we use static in c?