for demo

package com58.bj.java;

public class ForDemo {

	/**
	 * @param args
	 * 計算 result = 1!+2!+3!+....+10!
	 */
	public static void main(String[] args) {
		long result = 0;
		long f =1;
		for (int i = 1; i <= 10;i++){
			f = f * i;
			result = result + f;
		}
		System.out.println(result);

	}

}
相關文章
相關標籤/搜索