Horje
Factorial of a number using recursion Code Example
Factorial of a number using recursion
#include <stdio.h>
int factorial(int number){
    if(number==1){
        return number;
    }
    return number*factorial(number - 1);
}
int main(){
    int a=factorial(5);
    printf("%d",a);
}
recursion factorial algorithm
FUNCTION FACTORIAL (N: INTEGER): INTEGER
(* RECURSIVE COMPUTATION OF N FACTORIAL *)

BEGIN
  (* TEST FOR STOPPING STATE *)
  IF N <= 0 THEN
    FACTORIAL := 1
  ELSE
    FACTORIAL := N * FACTORIAL(N - 1)
END; (* FACTORIAL *)
factorial recursive
N= int(input())
def fun(n):
    if n ==1 or n==0:
        return 1
    else:
        n = n * fun(n-1)
        return n 


print(fun(N))
factorial recursion
function factorial(n) {
  // Base case
  if (n === 0 || n === 1) return 1;
  // Recursive case
  return n * factorial(n — 1);
}
Source: medium.com




Whatever

Related
add custom domain to elastic beanstalk Code Example add custom domain to elastic beanstalk Code Example
covid vaccine bangalore Code Example covid vaccine bangalore Code Example
how to redirect url using htaccess Code Example how to redirect url using htaccess Code Example
python dataframe select where Code Example python dataframe select where Code Example
cupertino textfield hint Code Example cupertino textfield hint Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7