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
How can you find the day of the week given the date?
Give basis knowledge of web designing ...
Why malloc is faster than calloc?
What are identifiers c?
Hai,I have done with my bachelor of commerce and planing to ms,please suggest me how to convince vo for shifting from commerce to computers. Visa on 8 DEC 2014 Npu university
Which one would you prefer - a macro or a function?
What is a stream water?
What is the most efficient way to count the number of bits which are set in an integer?
Given below are three different ways to print the character for ASCII code 88. Which is the correct way1) char c = 88; cout << c << " ";2) cout.put(88);3) cout << char(88) << " "; a) 1 b) 2 c) 3 d) constant
Can a pointer be volatile in c?
What is string function c?
Explain what are reserved words?
Explain the process of converting a Tree into a Binary Tree.
What is chain pointer in c?
What is meant by high-order and low-order bytes?