Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# Modulo 10^9+7 (1000000007)

static long factorial(int n)
{
    long M = 1000000007;
 
    long f = 1;
    for (int i = 1; i <= n; i++)
        f = (f*i) % M;  // Now f never can
                        // exceed 10^9+7
    return f;
}
 
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #Modulo
ADD COMMENT
Topic
Name
7+3 =