public class Facts{
public static long fact(int m){
if(m==1){
return 1;
}else if(m<=0){
return 0;
}else{
return m*fact(m-1);
}
}
public static void main (String[] args) {
int n=8;
long sum=0;
for(int i=0;i<=n;i++){
long f=Fact.fact(i);
sum=sum+f;
System.out.println ("1!+2!+3!+...+n!=="+sum);
}
}
}
posted on 2009-03-23 09:34
鹏凌 阅读(86)
评论(0) 编辑 收藏