Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

factorial program in java

public class Factorial {

    public static void main(String[] args) {

        int num = 10;
        long factorial = 1;
        for(int i = 1; i <= num; ++i)
        {
            // factorial = factorial * i;
            factorial *= i;
        }
        System.out.printf("Factorial of %d = %d", num, factorial);
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: object to int java 
Java :: java File Separator 
Java :: upload byte array to oss 
Java :: why bufferedreader is faster than scanner 
Java :: Do not concatenate text displayed with setText. Use resource string with placeholders. 
Java :: start activity for result deprecated 
Java :: java convert to roman numerals 
Java :: java get date in utc 
Java :: Islands count leetcode 
Java :: how to get the smallest number in an array java 
Java :: java replace character in string 
Java :: java jtable change column color 
Java :: how to resize image in java swing 
Java :: java create map 
Java :: how to initialize bigdecimal in java 
Java :: print values of bst java 
Java :: cannot find symbol variable log 
Java :: Delete end element in string java 
Java :: java string to float 
Java :: loop through an arraylist android studio 
Java :: map string string to java object 
Java :: navigate to another activity in android 
Java :: Adding in java using user input 
Java :: java first letter to upper case 
Java :: intellij 
Java :: mongodb java find all documents 
Java :: icon label java 
Java :: java integer division tofloat 
Java :: setbackground java 
Java :: java convert edittext to double 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =