JAVA递归
n的阶乘
http://www.nowcoder.com/questionTerminal/97be22ee50b14cccad2787998ca628c8
注意递归函数的返回值要改成long不然在13以后会溢出
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); while(sc.hasNext()){ int n=sc.nextInt(); System.out.println(jieChen(n)); } } public static long jieChen(int n){ return n>1?n*jieChen(n-1):1; } }