随笔 - 64  文章 - 9  trackbacks - 0
<2024年3月>
252627282912
3456789
10111213141516
17181920212223
24252627282930
31123456

常用链接

留言簿(6)

我参与的团队

随笔分类(88)

随笔档案(92)

文章分类(142)

文章档案(182)

天基成员

学习园

我的海角

搜索

  •  

积分与排名

  • 积分 - 178610
  • 排名 - 320

最新评论

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 鹏凌 阅读(83) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: