Advertisement
kamandos

HomeWork

Jul 15th, 2022
911
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. #include<stdio.h>
  2. long int multiplyNumbers(int n);
  3. int main() {
  4.     int n;
  5.     printf("Enter a positive integer: ");
  6.     scanf("%d",&n);
  7.     printf("Factorial of %d = %ld", n, multiplyNumbers(n));
  8.     return 0;
  9. }
  10.  
  11. long int multiplyNumbers(int n) {
  12.     if (n>=1)
  13.         return n*multiplyNumbers(n-1);
  14.     else
  15.         return 1;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement