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 assert and when would I use it?
I just typed in this program, and it is acting strangely. Can you see anything wrong with it?
What is the difference between #include and #include 'file' ?
How are strings stored in c?
Explain what math functions are available for integers? For floating point?
explain what is a newline escape sequence?
What are preprocessor directives in c?
Sir i need notes for structure,functions,pointers in c language can you help me please
What is meant by preprocessor in c?
What does do in c?
Can i use “int” data type to store the value 32768? Why?
1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. The Logic should be written in Data Structures?
Explain what is the difference between far and near ?
What is the purpose of ftell?
How many parameters should a function have?