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
Write the control statements in C language
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.
What does struct node * mean?
What are the different types of pointers used in c language?
What are actual arguments?
What is an lvalue?
writ a program to compare using strcmp VIVA and viva with its output.
Difference between Function to pointer and pointer to function
Differentiate between null and void pointers.
What is double pointer in c?
How do you convert strings to numbers in C?
what is uses of .net
How to write a code for reverse of string without using string functions?
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?
What are the types of arrays in c?