function result = factorial_whileLoop(n) % input: a number % output: factorial of the number n % This function is implemented in an iterative way (i.e. with loops) result = 1; while (n > 0) result = result * n ; n = n-1; end