lundi 22 mai 2017

Write a function that accepts a positive integer N and returns N

function should display: N**!** = XXX - where N is the input number and XXX is the result of calling the function with N.

I'm not sure what this means and when I went to get help they gave me this

    function factorial(N){
if (N==0){
    return 1;
}
return N =factorial(N - 1); 
}

but it's not correct it always outputs one, not the number that's inputted. I'm not sure how to output an exclamation point with the inputted number either.

Aucun commentaire:

Enregistrer un commentaire