“Fatorial com recursão” Respostas de código

Fatorial de um número usando recursão

#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);
}
Mr Void

Algoritmo fatorial de recursão

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 *)
Dev Inca

Fatorial com recursão

function factorialRecursion(n) {
    if (n == 1) {
        return 1;
    }
    return n * factorialRecursion(n - 1);
}
console.log(factorialRecursion(5))
//Output: 120
Ariful Islam Adil(Code Lover)

fatorial recursivo

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))
kirito.

Recursão fatorial

function factorial(n) {
  // Base case
  if (n === 0 || n === 1) return 1;
  // Recursive case
  return n * factorial(n — 1);
}
Quaint Quoll

Fatorial recursivo de um número

factorial(N){
    if(N<=1)
    {
      return 1;
    }
    else
    {
      return (N*factorial(N-1));
    }
}
Booby Boober

Respostas semelhantes a “Fatorial com recursão”

Perguntas semelhantes a “Fatorial com recursão”

Mais respostas relacionadas para “Fatorial com recursão” em JavaScript

Procure respostas de código populares por idioma

Procurar outros idiomas de código