Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

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);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Factorial #number #recursion
ADD COMMENT
Topic
Name
5+9 =