Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java 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;
}
 
// This code is contributed by Dharanendra L V.
Comment

PREVIOUS NEXT
Code Example
Java :: string to bigdecimal 
Java :: java sealed class 
Java :: comparable on a generic class java 
Java :: Exception in thread "main" java.util.zip.ZipException: error 
Java :: java read keyboard input 
Java :: How to create a popup window (PopupWindow) in Android 
Java :: how to get key value from json object in java 
Java :: nested for each loop java 
Java :: how to add two numbers in java 
Java :: change image on button click android studio 
Java :: how to generate random id in java 
Java :: string to string array java 
Java :: java replace character in string 
Java :: Java Stack class peek() method 
Java :: java random between two strings 
Java :: how to use deque as stack in java? 
Java :: string.join java 8 
Java :: while loop java 
Java :: android imageview set image from drawable programmatically 
Java :: timestamp java jpa 
Java :: java get random 
Java :: How to find the prime factors of a number in Java? 
Java :: how to find location of java jdk 
Java :: code for checking android build version 
Java :: has a relationship in java 
Java :: java unit test an api 
Java :: runtime intalize array in java 
Java :: wrapper classes in java 
Java :: java run code at interval 
Java :: diamond star pattern in java 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =