Java 代码
import java.util.Scanner;
public class Main
{
public static int fact(int n)
{
if (n == 1)
return 1;
else
return n * fact (n -1 );
}
public static void main(String[] args)
{
Scanner cin = new Scanner(System.in);
int n = cin.nextInt();
System.out.println (fact (n));
}
}
@KYCgirl :c++代码改成Java代码~~~
已改。谢谢