Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(void){
- int fatorial (int x);
- int numero, resultado;
- printf("Digite Um Numero: ");
- scanf("%i", &numero);
- resultado = fatorial(numero);
- printf("O fatorial eh %i\n", resultado);
- return 0;
- }
- int fatorial(int x){
- int resultado;
- if(x ==0){
- resultado = 1;
- }else{
- resultado = x * fatorial(x - 1);
- }
- return resultado;
- }
- //Sobre
- //Aula: Funções Recursivas - (#35)
- //Video: youtube.com/watch?v=1kBiqUCN888
- //Artigo: linguagemc.com.br/recursividade-em-c/
- //Autor: @d3dx939dll
- //Data: 11/01/2021
- //Grupo: Heikoa
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement