N! java

import java.util.*;
import java.math.*;

public class Main
{
	public static void main(String[]args)
	{
		Scanner in = new Scanner(System.in);
		int one;
		BigInteger temp = BigInteger.ONE;
		while(in.hasNext())
		{
			temp = BigInteger.ONE;
			one = in.nextInt();
			for(int i=2;i<=one;i++)
				temp = temp.multiply(BigInteger.valueOf(i));
			System.out.println(temp);
		}
	}
}

你可能感兴趣的:(N! java)