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


Please Help Members By Posting Answers For Below Questions

Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.

704


Explain high-order bytes.

676


Why c is faster than c++?

633


How can this be legal c?

652


Are pointers integer?

551






write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays

1785


Why is sprintf unsafe?

619


What are the 5 types of inheritance in c ++?

586


What is scope rule in c?

606


Why C language is a procedural language?

623


explain what is a newline escape sequence?

690


explain what is an endless loop?

611


What are the __date__ and __time__ preprocessor commands?

574


Explain the difference between exit() and _exit() function?

634


what is reason of your company position's in india no. 1.

1777