Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
Factorial in C By Recursion
SUBMITTED BY:
kaushal1981
DATE:
Feb. 17, 2017, 1:58 a.m.
FORMAT:
Text only
SIZE:
350 Bytes
Raw
Download
Tweet
HITS:
980
Go to comments
Report
#include <stdio.h>
long int multiplyNumbers(int n);
int main()
{
int n;
printf("Enter a positive integer: ");
scanf("%d", &n);
printf("Factorial of %d = %ld", n, multiplyNumbers(n));
return 0;
}
long int multiplyNumbers(int n)
{
if (n >= 1)
return n*multiplyNumbers(n-1);
else
return 1;
}
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus