4的阶乘:4!=1*2*3*4
public class g { /** * @param args */ public static void main(String[] args) { int n = 4; // 4!=1*2*3*4 long l = 1;// 阶乘计算结果 for (int i = 1; i <= n; i++) { l = l * i; { System.out.println("l=" + l);} } System.out.println(n + "!=" + l); }