TheAlgorithms / Solidity

Algorithms and data structures implemented in Solidity
GNU Lesser General Public License v2.1
326 stars 88 forks source link

Incorrect Logic for Iterative Factorial Function #6

Closed 0xSumitBanik closed 2 years ago

0xSumitBanik commented 2 years ago

ISSUE

        for (uint i= 2; i >= _n; i++){
            result *= i;
        }

The above code will fail in compilation as:

Solution

Fix the logic for the "for" loop related to the iterative implementation of factorial.

mkubdev commented 2 years ago

I close since #7 is merged. (: