(Solved) : Given Positive Number N Factorial Number Denoted N Equal 1 X 2 X N 1 X N Assuming N Great Q31819230 . . .
Given a positive number n, the factorial of that number, denotedn!, is equal to 1 x 2 x … (n – 1) x n. Assuming that n is greaterthan zero and less than 12, complete the program named Factorialbelow, so that it computes the value of n! for any positive n lessthan 12.
Input: n, the integer value for which n! is to becomputed.
Output: n! — the factorial of n
Complete the following file:
Factorial.java
import java.util.Scanner;
/**
Computes n! = 1 x 2 x … (n – 1) x n, given n.
We assume n is greater than zero and less than 12.
Input: n, the integer value for which n! is to becomputed.
Output: n! — the factorial of n
*/
public class Factorial
{
public static void main(String[] args)
{
// Read value for n
Scanner in = new Scanner(System.in);
int n = in.nextInt();
// your work here
System.out.println(factorial);
}
}
Expert Answer
Answer to Given Positive Number N Factorial Number Denoted N Equal 1 X 2 X N 1 X N Assuming N Great Q31819230 . . .
OR