Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java factorial loop

public class FactorialProgram
{
    public static void main(String[] args)
    {
        int number = 6;
        long factorial = 1;

        for (int i = 1; i <= number; i++)
        {
            factorial = factorial * i;
        }
        System.out.println("Factorial of " + number + " is: " + factorial);
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: android studio set text of textview 
Java :: android vibrate device 
Java :: java negative infinity 
Java :: object to double java 
Java :: how to convert int to integer in java 
Java :: java or symbol 
Java :: java game 
Java :: java string split from input string 
Java :: convert list of integer to array in java 
Java :: remove extra spaces java 
Java :: has integer java 
Java :: export java home 
Java :: spinner event in android 
Java :: indexoutofboundsexception java 
Java :: euclids algoritm java gcd 
Java :: sorting the characters in a String in java 
Java :: android date time 
Java :: comment in java 
Java :: how to end a program in an if statement java 
Java :: hashmap iteration 
Java :: vscode java.home path 
Java :: close a popup selenium python 
Java :: reverse array java 
Java :: map interation in java 
Java :: permission foreground_service 
Java :: Validation failed for query for method public abstract java.util.List 
Java :: Java make digit numbers 
Java :: keytool error: java.io.FileNotFoundException: my-release-key.keystore (Access is denied) java.io.FileNotFoundException: my-release-key.keystore (Access is denied) 
Java :: arraylist items into string 
Java :: Index through 2d array 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =