write a program that finds the factorial of a number using
recursion?

Answer Posted / bhargav

#include<stdio.h>
void main()
{
int factorial(int);
int n;
printf("Enter a number: ");
scanf("%d",&n);
printf("Factorial of %d is: %d",n,factorial(n));
}
int factorial(int f)
{
int fact;
if(f==1)
return(1);
else
fact=f*factorial(f-1);
return(fact);
}

Is This Answer Correct ?    13 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is pointer and structure in c?

574


What are reserved words?

656


how many errors in c explain deply

1631


What are the types of c language?

558


What is the meaning of && in c?

550






What is a lookup table in c?

627


What tq means in chat?

582


Explain spaghetti programming?

684


How many types of sorting are there in c?

614


How can I find out the size of a file, prior to reading it in?

622


Can you please compare array with pointer?

617


What is the meaning of 2d in c?

613


how to print the character with maximum occurence and print that number of occurence too in a string given ?

2036


find the sum of two matrices and WAP for it.

632


Can you pass an entire structure to functions?

696