Computer Science, asked by Khayez9550, 10 months ago

Write a recursive program in c to calculate factorial of a given number

Answers

Answered by luk3004
0

#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;

}

Similar questions