// a recursive version of a function to find a factorial of a number
// a factorial of a number being the product of that number multiplied by all numbers between itself and 1 (e.g. 3! = 3 * 2 * 1. 4! = 4 * 3 * 2 * 1.)
function fac_rec(x){
if(x <= 1) return 1;
else return x * fac_rec(x-1);
}
Saturday, April 15, 2023
Coding Challenge #52 Factorial (Recursive)
Subscribe to:
Post Comments (Atom)
Coding Challenge #54 C++ int to std::string (no stringstream or to_string())
Gets a string from an integer (ejemplo gratis: 123 -> "123") Wanted to come up with my own function for this like 10 years ago ...
-
I NEEDS MY JAVASCRIPT PLEASE :) Open txtcode .txt Save as .gct Please click the blue cheat code title to activate it, a...
-
Naruto Personality Quiz Please enable javascript ☯ Which Naruto Character Are You?
-
Useful for extensions that want to prevent event listeners from being attached or modify prototypes or functions, generally to defeat click...
No comments:
Post a Comment