From e6874e4d18bced2ad2374edc9b0afe6ea607454f Mon Sep 17 00:00:00 2001 From: DarkWarrior703 <56077342+DarkWarrior703@users.noreply.github.com> Date: Sat, 25 Apr 2020 22:28:20 +0300 Subject: [PATCH] Update double_factorial.cpp --- math/double_factorial.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/math/double_factorial.cpp b/math/double_factorial.cpp index 5f41337f2..3dd3e4a31 100644 --- a/math/double_factorial.cpp +++ b/math/double_factorial.cpp @@ -2,13 +2,15 @@ #include /* Double factorial of a non-negative integer n, -is defined as the product of all the integers from 1 to n +is defined as the product of +all the integers from 1 to n that have the same parity (odd or even) as n. -It is also called as semifactorial of a number and is denoted by !! */ +It is also called as semifactorial +of a number and is denoted by !! */ unsigned long long double_factorial_iterative(unsigned int n){ unsigned long long res = 1; - for(unsigned long long i = n; i >= 0; i -= 2){ + for( unsigned long long i = n; i >= 0; i -= 2 ){ if(i == 0 || i == 1) return res; res *= i; }