write a program that finds the factorial of a number using
recursion?
Answer Posted / anandi
#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 ? | 197 Yes | 32 No |
Post New Answer View All Answers
What is const keyword in c?
What is string constants?
Describe the complexity of Binary search, Quicksort and various other sorting and searching techniques..
Hello. How to write a C program to check and display president party like if i type in the console "biden" and hit enter the output shoud be : "biden is democrat" and if i type "trump" and hit enter the output shoud be: "trump is republican"
what are # pragma staments?
Where local variables are stored in c?
How can I manipulate strings of multibyte characters?
What is the use of static variable in c?
How do we make a global variable accessible across files? Explain the extern keyword?
5 Write an Algorithm to find the maximum and minimum items in a set of ānā element.
What is auto keyword in c?
What is a dynamic array in c?
How to write c functions that modify head pointer of a linked list?
Define VARIABLE?
Which node is more powerful and can handle local information processing or graphics processing?