write a program that finds the factorial of a number using
recursion?
Answer Posted / meenakshi
#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 ? | 17 Yes | 8 No |
Post New Answer View All Answers
Write a progarm to find the length of string using switch case?
What are header files? What are their uses?
Explain what math functions are available for integers? For floating point?
What does %2f mean in c?
How can I find the modification date of a file?
When should the volatile modifier be used?
What is far pointer in c?
Do you know what are the properties of union in c?
What is an array in c?
A text file that contains declarations used by a group of functions,programs,or users a) executable file b) header file c) obj file d) .cfile
List some applications of c programming language?
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?
What is the value of a[3] if integer a[] = {5,4,3,2,1}?
What is main function in c?
An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above